Validate formats in check_schema
#1280
Unanswered
alliefitter
asked this question in
Q&A
Replies: 1 comment
-
Hey there. Those actually aren't invalid formats according to the spec unfortunately. Specifically, implementations are supposed to ignore formats that aren't known to them. (See e.g. https://json-schema.org/draft/2020-12/json-schema-validation#name-implementation-requirements) The general answer to this I still consult is "a schema is not a replacement for your tests", so you should notice this by having a test you can't fail. But if you persist, you can also write a metaschema which constrains the set of formats to just the ones known by the library and then use that to validate your schema as well. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm wondering if there's a way to validate formats when using
check_schema
. It seems to allow invalid format names. The below example passes validation, even thoughdatetime
should bedate-time
. I noticed the concrete implementation ofcheck_schema
has aformat_checker
argument (even though theFormatChecker
protocol does not have this argument). Setting the format checker doesn't validate format names either. Is there anyway to getcheck_schema
to fail for invalid formats?Beta Was this translation helpful? Give feedback.
All reactions