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

validate.py should return an error if schema can't be found #268

Closed
magnusbaeck opened this issue Aug 1, 2021 · 1 comment · Fixed by #270
Closed

validate.py should return an error if schema can't be found #268

magnusbaeck opened this issue Aug 1, 2021 · 1 comment · Fixed by #270
Assignees

Comments

@magnusbaeck
Copy link
Member

Description

If examples/validate.py can't find a schema referenced in one of the example files this only results in a warning and a zero exit code rather than a non-zero exit code that one could reasonably expect.

Motivation

A non-existent schema version referenced in an example file is likely to be a real error and should be treated as such. I can't come up with a use case where you'd have example files that reference non-existent schema versions.

Exemplification

Changing the event version of a randomly chosen example file to something bogus could easily be overlooked (especially if #265 is implemented and we start trusting the validation results):

$ python examples/validate.py
Loaded 105 schemas.
Loaded 94 examples.
WARNING: Missing schema for aaaaaaaa-bbbb-5ccc-8ddd-eeeeeeeeeee0(EiffelActivityCanceledEvent) in examples/events/EiffelActivityCanceledEvent/simple.json.

===SUMMARY===
Bad schema files:         0
Bad example files:        0
Successful validations:   93
Failed validations:       0
Unchecked examples:       1
=============
$ echo $?
0

Benefits

Reduced risk of mistakes when updating the example files.

Possible Drawbacks

None? Making missing schemas a non-error appears to be a conscious decision but I don't understand that rationale behind it. If there's a reasonable use case for the current behavior we could add a --strict flag or similar, or the reverse by making the default behavior fatal and adding a --ignore-missing-schema flag.

@e-backmark-ericsson
Copy link
Member

I agree. The examples should reference valid schemas.

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

Successfully merging a pull request may close this issue.

2 participants