Skip to content

Commit 4ee9d5e

Browse files
feat: implement new rule to check illogical usage of composition keywords
feat: add proper check for mutually exclusive schemas in oneOf feat: add checks for object min/max props, required props and additionlProperties feat: add rule to the oas3_2 spec refactor: functions naming and returning type refactor: change if statement refactor: move areDuplicatedSchemas function to utility and change naming feat: add new rule no-illogical-any-of-usage chore: add new rule to type fix: getEffectiveBounds functionality, pattern check and mutualExclusibity check feat: add functionality to report more then 1 problem chore: improve warning messages feat: add proper checks, refactor and change error messages fix: error message in areDuplicatedSchemas refactor: move logic into main function, add helper function, rename utility function refactor: change naming and functionality for duplicated shcemas function refactor: nullable function and return statement fix: nullable type detection refactor: add utility functions refactor: remove functions, clean code, refactor additionalProperties refactor: functions naming, if statement chore: remove oneOf/anyOf/allOf separate rules and add one to handle different behavior feat: add proper handling for additionalProperties chore: update type feat: add functionality to handle anyOf and allOf checks
1 parent 26e0206 commit 4ee9d5e

File tree

8 files changed

+511
-0
lines changed

8 files changed

+511
-0
lines changed

packages/core/src/config/all.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ const all: RawGovernanceConfig<'built-in'> = {
117117
'tag-description': 'error',
118118
'tags-alphabetical': 'error',
119119
'no-duplicated-tag-names': 'error',
120+
'no-illogical-composition-keywords': 'error',
120121
},
121122
oas3_1Rules: {
122123
'array-parameter-serialization': 'error',
@@ -179,6 +180,7 @@ const all: RawGovernanceConfig<'built-in'> = {
179180
'tag-description': 'error',
180181
'tags-alphabetical': 'error',
181182
'no-duplicated-tag-names': 'error',
183+
'no-illogical-composition-keywords': 'error',
182184
},
183185
oas3_2Rules: {
184186
'array-parameter-serialization': 'error',
@@ -241,6 +243,7 @@ const all: RawGovernanceConfig<'built-in'> = {
241243
'tag-description': 'error',
242244
'tags-alphabetical': 'error',
243245
'no-duplicated-tag-names': 'error',
246+
'no-illogical-composition-keywords': 'error',
244247
},
245248
async2Rules: {
246249
'channels-kebab-case': 'error',

packages/core/src/config/minimal.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ const minimal: RawGovernanceConfig<'built-in'> = {
108108
'tag-description': 'warn',
109109
'tags-alphabetical': 'off',
110110
'no-duplicated-tag-names': 'off',
111+
'no-illogical-composition-keywords': 'off',
111112
},
112113
oas3_1Rules: {
113114
'array-parameter-serialization': 'off',
@@ -164,6 +165,7 @@ const minimal: RawGovernanceConfig<'built-in'> = {
164165
'tag-description': 'warn',
165166
'tags-alphabetical': 'off',
166167
'no-duplicated-tag-names': 'off',
168+
'no-illogical-composition-keywords': 'off',
167169
},
168170
oas3_2Rules: {
169171
'array-parameter-serialization': 'off',
@@ -220,6 +222,7 @@ const minimal: RawGovernanceConfig<'built-in'> = {
220222
'tag-description': 'warn',
221223
'tags-alphabetical': 'off',
222224
'no-duplicated-tag-names': 'off',
225+
'no-illogical-composition-keywords': 'off',
223226
},
224227
async2Rules: {
225228
'channels-kebab-case': 'off',

packages/core/src/config/recommended-strict.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ const recommendedStrict: RawGovernanceConfig<'built-in'> = {
108108
'tag-description': 'error',
109109
'tags-alphabetical': 'off',
110110
'no-duplicated-tag-names': 'error',
111+
'no-illogical-composition-keywords': 'error',
111112
},
112113
oas3_1Rules: {
113114
'array-parameter-serialization': 'off',
@@ -164,6 +165,7 @@ const recommendedStrict: RawGovernanceConfig<'built-in'> = {
164165
'tag-description': 'error',
165166
'tags-alphabetical': 'off',
166167
'no-duplicated-tag-names': 'error',
168+
'no-illogical-composition-keywords': 'error',
167169
},
168170
oas3_2Rules: {
169171
'array-parameter-serialization': 'off',
@@ -220,6 +222,7 @@ const recommendedStrict: RawGovernanceConfig<'built-in'> = {
220222
'tag-description': 'error',
221223
'tags-alphabetical': 'off',
222224
'no-duplicated-tag-names': 'error',
225+
'no-illogical-composition-keywords': 'error',
223226
},
224227
async2Rules: {
225228
'channels-kebab-case': 'off',

packages/core/src/config/recommended.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ const recommended: RawGovernanceConfig<'built-in'> = {
108108
'tag-description': 'warn',
109109
'tags-alphabetical': 'off',
110110
'no-duplicated-tag-names': 'warn',
111+
'no-illogical-composition-keywords': 'warn',
111112
},
112113
oas3_1Rules: {
113114
'array-parameter-serialization': 'off',
@@ -164,6 +165,7 @@ const recommended: RawGovernanceConfig<'built-in'> = {
164165
'tag-description': 'warn',
165166
'tags-alphabetical': 'off',
166167
'no-duplicated-tag-names': 'warn',
168+
'no-illogical-composition-keywords': 'warn',
167169
},
168170
oas3_2Rules: {
169171
'array-parameter-serialization': 'off',
@@ -220,6 +222,7 @@ const recommended: RawGovernanceConfig<'built-in'> = {
220222
'tag-description': 'warn',
221223
'tags-alphabetical': 'off',
222224
'no-duplicated-tag-names': 'warn',
225+
'no-illogical-composition-keywords': 'warn',
223226
},
224227
async2Rules: {
225228
'channels-kebab-case': 'off',

packages/core/src/config/spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ const spec: RawGovernanceConfig<'built-in'> = {
108108
'tag-description': 'off',
109109
'tags-alphabetical': 'off',
110110
'nullable-type-sibling': 'error',
111+
'no-illogical-composition-keywords': 'off',
111112
},
112113
oas3_1Rules: {
113114
'array-parameter-serialization': 'off',
@@ -164,6 +165,7 @@ const spec: RawGovernanceConfig<'built-in'> = {
164165
'spec-components-invalid-map-name': 'error',
165166
'tag-description': 'off',
166167
'tags-alphabetical': 'off',
168+
'no-illogical-composition-keywords': 'error',
167169
},
168170
oas3_2Rules: {
169171
'array-parameter-serialization': 'off',
@@ -220,6 +222,7 @@ const spec: RawGovernanceConfig<'built-in'> = {
220222
'spec-components-invalid-map-name': 'error',
221223
'tag-description': 'off',
222224
'tags-alphabetical': 'off',
225+
'no-illogical-composition-keywords': 'error',
223226
},
224227
async2Rules: {
225228
'channels-kebab-case': 'off',

packages/core/src/rules/oas3/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import { NoRequiredSchemaPropertiesUndefined } from '../common/no-required-schem
5555
import { NoSchemaTypeMismatch } from '../common/no-schema-type-mismatch.js';
5656
import { NoDuplicatedTagNames } from '../common/no-duplicated-tag-names.js';
5757
import { NullableTypeSibling } from './nullable-type-sibling.js';
58+
import { NoIllogicalCompositionKeywords } from './no-illogical-composition-keywords.js';
5859

5960
import type { Oas3RuleSet } from '../../oas-types.js';
6061
import type { Oas3Rule } from '../../visitors.js';
@@ -118,6 +119,7 @@ export const rules: Oas3RuleSet<'built-in'> = {
118119
'no-schema-type-mismatch': NoSchemaTypeMismatch as Oas3Rule,
119120
'no-duplicated-tag-names': NoDuplicatedTagNames as Oas3Rule,
120121
'nullable-type-sibling': NullableTypeSibling,
122+
'no-illogical-composition-keywords': NoIllogicalCompositionKeywords,
121123
};
122124

123125
export const preprocessors = {};

0 commit comments

Comments
 (0)