-
Notifications
You must be signed in to change notification settings - Fork 42
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
Proposal: consolidate JSON schema tests using keys #116
Conversation
Rather than splitting files into individual folders, this commit makes use of top-level keys (valid, recommended) to indicate whether a file should validate against image.schema and strict_image.schema The unit tests are updated to use a single glob and detect the appropriate schema based on the presence of the multiscales key
Looks good 👍 |
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.
Looks good. Slightly counter-intuitive to add false
flags, but I think I can understand.
Do you mean the keys should be expected to have different default values? Or that the new keys should be defined in all snippets whether they are |
My reading of https://github.com/json-schema-org/JSON-Schema-Test-Suite#structure-of-a-test made me expect rather than:
to have:
|
True, the JSON schema test suite format wraps the JSON to test within a I hesitated to implement it as part of the proposal primarily because it breaks the inclusion logic of #98. If the format sounds valuable, I can look into refactoring these examples one step further to follow the JSON schema test suite format more closely. |
Ah, understood. But we'll need to strip |
Maybe that's the bit of explanation that was missing in my answer to @will-moore's question above. To avoid stripping of the |
Summary of a quick discussion with @joshmoore. Having spent more time implementing #116 (comment), I am increasingly considering the following organisation which should bring a good compromise between extensibility and support for new specification schemas and usability:
|
See #112 (comment) for more context. As new JSON schemas and associated validation samples are about to be introduced both for existing and upcoming specification, the initial layout for the JSON test files need to be revisited.
This PR explores an alternative proposal to the top-level
valid
,valid_strict
,invalid
folders introduced in #87 #92 and is inspired by the JSON schema test suite - https://github.com/json-schema-org/JSON-Schema-Test-Suite#structure-of-a-test.Each JSON file can annoted with a top-level
valid
and/orrecommended
key which indicates whether the metadata is minimally compliant or fully compliant with the specification. The Python tests are updated to use a singleglob.glob
and collect all*.json
files, select the schema to use based on the presence of themultiscales
key and use thevalid/recommended
keys to test thevalidate
outcome.Using this approach, all JSON files associated with the
image.schema
can be simply grouped into theexamples/image
subfolder, examples associated withplate.schema
would be underexamples/plate
etc