Skip to content

Validate examples within the schema #1281

Answered by Julian
cc-stjm asked this question in Q&A
Discussion options

You must be logged in to vote

Hi there!

I assume you mean "I want to ensure that things in the examples keyword are valid under the schema they live inside"?
That's behavior not part of the specification (which basically says to do nothing with that keyword), though of course it's reasonable to want it.

There's not a public API built in at the moment for walking schemas (to e.g. find instances of the keyword) if you want to do this dynamically without knowledge of the specific schema -- such an API will come some day.

In the interim of course though you could either write the (fairly simple) function which walks a schema looking for the keyword, and just call validate.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@cc-stjm
Comment options

@Julian
Comment options

Answer selected by cc-stjm
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1279 on July 03, 2024 15:33.