-
-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): support JSON ruleset validation (#2062)
- Loading branch information
Showing
25 changed files
with
501 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
packages/core/src/ruleset/__tests__/__fixtures__/foo-extends-bar-ruleset.json
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
packages/core/src/ruleset/__tests__/__fixtures__/foo-ruleset.json
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
packages/core/src/ruleset/__tests__/__fixtures__/invalid-ruleset.json
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
packages/core/src/ruleset/__tests__/__fixtures__/ruleset-with-merge-keys.yaml
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
packages/core/src/ruleset/__tests__/__fixtures__/ruleset-with-missing-functions.json
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
packages/core/src/ruleset/__tests__/__fixtures__/valid-flat-ruleset-2.json
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
packages/core/src/ruleset/__tests__/__fixtures__/valid-flat-ruleset.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "@stoplight/spectral-core/meta/extensions", | ||
"$defs": { | ||
"Extends": { | ||
"$anchor": "extends", | ||
"oneOf": [ | ||
{ | ||
"$id": "ruleset", | ||
"$ref": "ruleset.schema#", | ||
"errorMessage": "must be a valid ruleset" | ||
}, | ||
{ | ||
"type": "array", | ||
"items": { | ||
"anyOf": [ | ||
{ | ||
"$ref": "ruleset" | ||
}, | ||
{ | ||
"type": "array", | ||
"minItems": 2, | ||
"additionalItems": false, | ||
"items": [ | ||
{ | ||
"$ref": "ruleset" | ||
}, | ||
{ | ||
"type": "string", | ||
"enum": ["off", "recommended", "all"], | ||
"errorMessage": "allowed types are \"off\", \"recommended\" and \"all\"" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"errorMessage": "must be a valid ruleset" | ||
}, | ||
"Format": { | ||
"$anchor": "format", | ||
"spectral-runtime": "format", | ||
"errorMessage": "must be a valid format" | ||
}, | ||
"Function": { | ||
"$anchor": "function", | ||
"spectral-runtime": "function", | ||
"type": "object", | ||
"properties": { | ||
"function": true | ||
}, | ||
"required": ["function"] | ||
}, | ||
"Functions": { | ||
"$anchor": "functions", | ||
"not": {} | ||
}, | ||
"FunctionsDir": { | ||
"$anchor": "functionsDir", | ||
"not": {} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "@stoplight/spectral-core/meta/extensions", | ||
"$defs": { | ||
"Extends": { | ||
"$anchor": "extends", | ||
"oneOf": [ | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"type": "array", | ||
"items": { | ||
"oneOf": [ | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"type": "array", | ||
"minItems": 2, | ||
"additionalItems": false, | ||
"items": [ | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"enum": ["all", "recommended", "off"], | ||
"errorMessage": "allowed types are \"off\", \"recommended\" and \"all\"" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
] | ||
}, | ||
"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" | ||
], | ||
"errorMessage": "must be a valid format" | ||
}, | ||
"Functions": { | ||
"$anchor": "functions", | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"FunctionsDir": { | ||
"$anchor": "functionsDir", | ||
"type": "string" | ||
}, | ||
"Function": { | ||
"$anchor": "function", | ||
"type": "object", | ||
"properties": { | ||
"function": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": ["function"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.