Skip to content

Commit

Permalink
feat(core): relax formats validation (#2151)
Browse files Browse the repository at this point in the history
  • Loading branch information
P0lip authored Apr 25, 2023
1 parent ff7d654 commit de16b4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
17 changes: 1 addition & 16 deletions packages/core/src/ruleset/meta/json-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,7 @@
},
"Format": {
"$anchor": "format",
"enum": [
"oas2",
"oas3",
"oas3.0",
"oas3.1",
"asyncapi2",
"json-schema",
"json-schema-loose",
"json-schema-draft4",
"json-schema-draft6",
"json-schema-draft7",
"json-schema-draft-2019-09",
"json-schema-2019-09",
"json-schema-draft-2020-12",
"json-schema-2020-12"
],
"type": "string",
"errorMessage": "must be a valid format"
},
"Functions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -941,14 +941,14 @@ describe('JSON Ruleset Validation', () => {

it.each<[unknown, RulesetValidationError[]]>([
[
[2, 'a'],
[2, null],
[
new RulesetValidationError('invalid-format', 'must be a valid format', ['formats', '0']),
new RulesetValidationError('invalid-format', 'must be a valid format', ['formats', '1']),
],
],
[2, [new RulesetValidationError('invalid-ruleset-definition', 'must be an array of formats', ['formats'])]],
[[''], [new RulesetValidationError('invalid-format', 'must be a valid format', ['formats', '0'])]],
[[null], [new RulesetValidationError('invalid-format', 'must be a valid format', ['formats', '0'])]],
])('recognizes invalid ruleset %p formats syntax', (formats, errors) => {
expect(
assertValidRuleset.bind(
Expand Down Expand Up @@ -985,7 +985,7 @@ describe('JSON Ruleset Validation', () => {

it.each<[unknown, RulesetValidationError[]]>([
[
[2, 'a'],
[2, null],
[
new RulesetValidationError('invalid-format', 'must be a valid format', ['rules', 'rule', 'formats', '0']),
new RulesetValidationError('invalid-format', 'must be a valid format', ['rules', 'rule', 'formats', '1']),
Expand Down

0 comments on commit de16b4c

Please sign in to comment.