-
Notifications
You must be signed in to change notification settings - Fork 320
[WIP] Support JSON Schema 2019 and 2020 #1166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[WIP] Support JSON Schema 2019 and 2020 #1166
Conversation
Signed-off-by: Morgan Chang <[email protected]>
Signed-off-by: Morgan Chang <[email protected]>
…pendencies for backward compatibility Signed-off-by: Morgan Chang <[email protected]>
| import type { ASTNode } from '../jsonASTTypes'; | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| export function getNodeValue(node: ASTNode): any { |
Check warning
Code scanning / ESLint
Disallow the `any` type Warning
| public enumValueMatch = false; | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| public enumValues: any[] = null; |
Check warning
Code scanning / ESLint
Disallow the `any` type Warning
| originalSchema: JSONSchema, | ||
| validationResult: ValidationResult, | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| _options: Options |
Check warning
Code scanning / ESLint
Disallow unused variables Warning
| // ---------------- unevaluated hooks (2019/2020) ---------------- | ||
| protected applyUnevaluatedProperties( | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| _node: ObjectASTNode, |
Check warning
Code scanning / ESLint
Disallow unused variables Warning
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| _node: ObjectASTNode, | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| _schema: JSONSchema, |
Check warning
Code scanning / ESLint
Disallow unused variables Warning
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| _validationResult: ValidationResult, | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| _matchingSchemas: ISchemaCollector, |
Check warning
Code scanning / ESLint
Disallow unused variables Warning
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| _matchingSchemas: ISchemaCollector, | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| _options: Options |
Check warning
Code scanning / ESLint
Disallow unused variables Warning
|
|
||
| const propertyNode = child.type === 'property' ? child : (child.parent as ASTNode); | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| const keyNode = (propertyNode as any).keyNode; |
Check warning
Code scanning / ESLint
Disallow the `any` type Warning
| let current: any = schema; | ||
| if (path[0] === '/') { | ||
| path = path.substr(1); | ||
| const push = (v: any): void => { |
Check warning
Code scanning / ESLint
Disallow the `any` type Warning
| // JSON pointer style (starts with "/") | ||
| if (refPath[0] === '/') { | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| let current: any = schemaRoot; |
Check warning
Code scanning / ESLint
Disallow the `any` type Warning
What does this PR do?
Changes
Refactor / architecture
Draft 2019-09 support
$anchorresolution$defsresolution (renamed +definitionscompat)definitions)$id$recursiveAnchor/$recursiveRef$ref(allow other keywords alongside)$vocabularydependentSchemasdependenciescompatunevaluatedItemsunevaluatedPropertiesdependentRequireddependenciescompatcontains+minContains/maxContainsDraft 2020-12 support
prefixItems+items$dynamicAnchor/$dynamicRefcontainsandunevaluatedItemssafeCreateUnicodeRegExp()format-annotation+format-assertion...
What issues does this PR fix or reference?
#856
#1112
Related work: #1164 adds draft 2019/2020 meta‑validation support.
Is it tested? How?