-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: Use latest ajv #166
feat: Use latest ajv #166
Conversation
"contains": { | ||
"const": "https://stac.linz.govt.nz/_STAC_VERSION_/film/schema.json" | ||
} | ||
}, | ||
{ | ||
"type": "array", |
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.
Why does 'array' need to be specified for each item?
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.
The docs clarify this:
This is a very common mistake that even people experienced with JSON Schema often make - the problem here is that any value that is not an [array] would be valid against this schema - this is rarely intentional.
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.
In fact, looking at the output there are a bunch more of these. I'll do those as well, but I've put those in a separate PR.
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.
I'm not sure i follow the docs here, do you have an example of what would be valid that shouldn't be valid?
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.
I can't seem to create a test which makes the fixes necessary, so it's possible ajv is just being overzealous. There are a few issues related to how strictTypes
works, but I couldn't see one which is strictly equivalent to not being useful. I guess this would just be a "better safe than sorry" change, which we can refine if/when ajv refines their validation.
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.
I wonder why its a lint issue then 🤷 ?
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.
Because, in general, if you don't specify the type any type is valid. If you happen to have a sufficiently loose child schema this might result in weird stuff like making a null valid in place of an object.
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.
In any case, this discussion is now relevant for the other PR. What do you think of the current PR?
4b2dc2a
to
25f0c77
Compare
4352e49
to
6a0f934
Compare
No description provided.