Skip to content
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

breaking: JSON Schema draft-2020-12 #105

Open
Eomm opened this issue Aug 26, 2023 · 4 comments
Open

breaking: JSON Schema draft-2020-12 #105

Eomm opened this issue Aug 26, 2023 · 4 comments

Comments

@Eomm
Copy link
Member

Eomm commented Aug 26, 2023

Evaluate if the next major version should set the JSON schema draft-2020-12 as default

Ref: fastify/fastify#4549
AJV docs: https://ajv.js.org/guide/schema-language.html#draft-2019-09-and-draft-2020-12

@jsumners
Copy link
Member

The AJV docs recommend sticking with 07 if you don't need the two new properties as all schemas will be affected by the reduced performance required to support them.

@Eomm
Copy link
Member Author

Eomm commented Aug 27, 2023

I'm not too much into it tbh - I think we can provide:

  1. an option to let the user switch the json version
  2. release a npm tagged version that is equal to main but loads the other json schema standard
  3. other ideas...

@gurgunday
Copy link
Member

The AJV docs recommend sticking with 07 if you don't need the two new properties as all schemas will be affected by the reduced performance required to support them.

Wow, I just discovered this:

Draft-2019-09 features performance cost (even when not used)

+1 for keeping 07 the default and letting the user choose

@bcomnes
Copy link

bcomnes commented Oct 9, 2024

Somewhat related, is there a way to opt into the 2019 or 2020 version without having to re-implement a ValidatorCompiler? (Like opt into the defaults, but with a few more of the keywords).

If you register 2019, and add the 07 spec, can you pick which one you use with the $schema field?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants