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

format double & int64 & int not compatible with ajv #97

Open
GopherJ opened this issue Aug 15, 2021 · 4 comments
Open

format double & int64 & int not compatible with ajv #97

GopherJ opened this issue Aug 15, 2021 · 4 comments

Comments

@GopherJ
Copy link

GopherJ commented Aug 15, 2021

I use schemars to generate schema but the generated schema cannot be validated by ajv, https://github.com/ajv-validator/ajv

@GopherJ
Copy link
Author

GopherJ commented Aug 15, 2021

if I remove all format: int64, format:int, format:double then it's ok

@ahl
Copy link
Contributor

ahl commented Aug 18, 2021

That sounds like a bug in ajv:

https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.7.2.3

An implementation MUST NOT fail validation or cease processing due to an unknown format attribute.

@JonathanPlasse
Copy link

I had the same problem with "format": uint with Ruff and it was likewise solved by removing it.

@GREsau
Copy link
Owner

GREsau commented Nov 22, 2024

Copying my comment from here:

You could say these format values are non-standard, but I don't agree that they're "non-compliant", since as you said the JSON schema spec (at least, the current version) allows custom formats.

I'm considering adding minimum/maximum to some integer schemas depending on their size, see this comment for some of my thoughts on that, although I would probably still keep the custom formats. I'm open to implementing a built-in schema transform that would remove non-standard formats, although adding that to the generator would be opt-in.

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