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
json-schema: v6 and v7 changed to better comply with the draft definitions. #29026
Conversation
@afinch7 Thank you for submitting this PR! 🔔 @bcherny @cyrilletuzi @LucianBuzzo @rolandjitsu - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
@afinch7 What is the motivation of this PR? I don't see what it adds except refactoring, and I'm not confident in validating the changes, change from interface to type could have side effects. |
@cyrilletuzi I second that. I cannot see how a schema object can be a boolean, at least not the root schema object. |
According to the draft 07 and 06 specs any field that can be a schema object can be a boolean as well. Note this declaration in the 07 and 06 schemas. (see http://json-schema.org/draft-07/schema# and http://json-schema.org/draft-06/schema#)
This means that a schema like this
while mostly pointless is still valid, and more importantly
is valid. I could have changed the definition of additionalProperties to be "boolean | JSONSchema6/7", but this doesn't correctly reflect the schema definition. TL;DR; |
@cyrilletuzi As for the interface to type change. I do see the potential for problems.
This will no longer compile. I see there being two options to resolve this. Make this a breaking change or refactor this change to something like
There may be a better way to refactor that not sure. What do you think? |
@afinch7 I'm aware of that, but making the root schema a boolean makes no sense, especially when you're extending the interface or implementing it. Your second suggestion would work though. |
…hema6/7 and added test to avoid breaking this in the future.
Alright I created a test for the class implementation cases and |
Refactored my changes to avoid breaking class implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
A definition owner has approved this PR ⭐️. A maintainer will merge this PR shortly. If it shouldn't be merged yet, please leave a comment saying so and we'll wait. Thank you for your contribution to DefinitelyTyped! |
Please fill in this template.
npm test
.)npm run lint package-name
(ortsc
if notslint.json
is present).Select one of these and delete the others:
If changing an existing definition:
https://json-schema.org/draft-07/schema#