Skip to content

Commit b6216c1

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 79b61a5 commit b6216c1

8 files changed

Lines changed: 511 additions & 0 deletions

File tree

packages/core/src/config/all.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const all: RawGovernanceConfig<'built-in'> = {
118118
'tags-alphabetical': 'error',
119119
'no-duplicated-tag-names': 'error',
120120
'spec-example-values': 'error',
121+
'no-illogical-composition-keywords': 'error',
121122
},
122123
oas3_1Rules: {
123124
'array-parameter-serialization': 'error',
@@ -181,6 +182,7 @@ const all: RawGovernanceConfig<'built-in'> = {
181182
'tags-alphabetical': 'error',
182183
'no-duplicated-tag-names': 'error',
183184
'spec-example-values': 'error',
185+
'no-illogical-composition-keywords': 'error',
184186
},
185187
oas3_2Rules: {
186188
'array-parameter-serialization': 'error',
@@ -246,6 +248,7 @@ const all: RawGovernanceConfig<'built-in'> = {
246248
'spec-no-invalid-encoding-combinations': 'error',
247249
'spec-discriminator-defaultMapping': 'error',
248250
'spec-example-values': 'error',
251+
'no-illogical-composition-keywords': 'error',
249252
},
250253
async2Rules: {
251254
'channels-kebab-case': 'error',

packages/core/src/config/minimal.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ const minimal: RawGovernanceConfig<'built-in'> = {
109109
'tags-alphabetical': 'off',
110110
'no-duplicated-tag-names': 'off',
111111
'spec-example-values': 'off',
112+
'no-illogical-composition-keywords': 'off',
112113
},
113114
oas3_1Rules: {
114115
'array-parameter-serialization': 'off',
@@ -165,6 +166,7 @@ const minimal: RawGovernanceConfig<'built-in'> = {
165166
'tag-description': 'warn',
166167
'tags-alphabetical': 'off',
167168
'no-duplicated-tag-names': 'off',
169+
'no-illogical-composition-keywords': 'off',
168170
'spec-example-values': 'off',
169171
},
170172
oas3_2Rules: {
@@ -221,6 +223,7 @@ const minimal: RawGovernanceConfig<'built-in'> = {
221223
'tag-description': 'warn',
222224
'tags-alphabetical': 'off',
223225
'no-duplicated-tag-names': 'off',
226+
'no-illogical-composition-keywords': 'off',
224227
'spec-no-invalid-tag-parents': 'warn',
225228
'spec-no-invalid-encoding-combinations': 'warn',
226229
'spec-discriminator-defaultMapping': 'off',

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ const recommendedStrict: RawGovernanceConfig<'built-in'> = {
109109
'tags-alphabetical': 'off',
110110
'no-duplicated-tag-names': 'error',
111111
'spec-example-values': 'off',
112+
'no-illogical-composition-keywords': 'error',
112113
},
113114
oas3_1Rules: {
114115
'array-parameter-serialization': 'off',
@@ -165,6 +166,7 @@ const recommendedStrict: RawGovernanceConfig<'built-in'> = {
165166
'tag-description': 'error',
166167
'tags-alphabetical': 'off',
167168
'no-duplicated-tag-names': 'error',
169+
'no-illogical-composition-keywords': 'error',
168170
'spec-example-values': 'off',
169171
},
170172
oas3_2Rules: {
@@ -221,6 +223,7 @@ const recommendedStrict: RawGovernanceConfig<'built-in'> = {
221223
'tag-description': 'error',
222224
'tags-alphabetical': 'off',
223225
'no-duplicated-tag-names': 'error',
226+
'no-illogical-composition-keywords': 'error',
224227
'spec-no-invalid-tag-parents': 'error',
225228
'spec-no-invalid-encoding-combinations': 'error',
226229
'spec-discriminator-defaultMapping': 'error',

packages/core/src/config/recommended.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ const recommended: RawGovernanceConfig<'built-in'> = {
109109
'tags-alphabetical': 'off',
110110
'no-duplicated-tag-names': 'warn',
111111
'spec-example-values': 'off',
112+
'no-illogical-composition-keywords': 'warn',
112113
},
113114
oas3_1Rules: {
114115
'array-parameter-serialization': 'off',
@@ -166,6 +167,7 @@ const recommended: RawGovernanceConfig<'built-in'> = {
166167
'tags-alphabetical': 'off',
167168
'no-duplicated-tag-names': 'warn',
168169
'spec-example-values': 'off',
170+
'no-illogical-composition-keywords': 'warn',
169171
},
170172
oas3_2Rules: {
171173
'array-parameter-serialization': 'off',
@@ -225,6 +227,7 @@ const recommended: RawGovernanceConfig<'built-in'> = {
225227
'spec-no-invalid-encoding-combinations': 'error',
226228
'spec-discriminator-defaultMapping': 'warn',
227229
'spec-example-values': 'error',
230+
'no-illogical-composition-keywords': 'warn',
228231
},
229232
async2Rules: {
230233
'channels-kebab-case': 'off',

packages/core/src/config/spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ const spec: RawGovernanceConfig<'built-in'> = {
109109
'tags-alphabetical': 'off',
110110
'nullable-type-sibling': 'error',
111111
'spec-example-values': 'off',
112+
'no-illogical-composition-keywords': 'off',
112113
},
113114
oas3_1Rules: {
114115
'array-parameter-serialization': 'off',
@@ -166,6 +167,7 @@ const spec: RawGovernanceConfig<'built-in'> = {
166167
'tag-description': 'off',
167168
'tags-alphabetical': 'off',
168169
'spec-example-values': 'off',
170+
'no-illogical-composition-keywords': 'error',
169171
},
170172
oas3_2Rules: {
171173
'array-parameter-serialization': 'off',
@@ -225,6 +227,7 @@ const spec: RawGovernanceConfig<'built-in'> = {
225227
'spec-no-invalid-encoding-combinations': 'error',
226228
'spec-discriminator-defaultMapping': 'error',
227229
'spec-example-values': 'error',
230+
'no-illogical-composition-keywords': 'error',
228231
},
229232
async2Rules: {
230233
'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
@@ -59,6 +59,7 @@ import { SpecNoInvalidTagParents } from './spec-no-invalid-tag-parents.js';
5959
import { SpecNoInvalidEncodingCombinations } from './spec-no-invalid-encoding-combinations.js';
6060
import { SpecDiscriminatorDefaultMapping } from './spec-discriminator-defaultMapping.js';
6161
import { SpecExampleValues } from './spec-example-values.js';
62+
import { NoIllogicalCompositionKeywords } from './no-illogical-composition-keywords.js';
6263

6364
import type { Oas3RuleSet } from '../../oas-types.js';
6465
import type { Oas3Rule } from '../../visitors.js';
@@ -126,6 +127,7 @@ export const rules: Oas3RuleSet<'built-in'> = {
126127
'spec-no-invalid-encoding-combinations': SpecNoInvalidEncodingCombinations,
127128
'spec-discriminator-defaultMapping': SpecDiscriminatorDefaultMapping,
128129
'spec-example-values': SpecExampleValues,
130+
'no-illogical-composition-keywords': NoIllogicalCompositionKeywords,
129131
};
130132

131133
export const preprocessors = {};

0 commit comments

Comments
 (0)