Skip to content

cli.py should check_schema before using it. #208

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

Closed
Parakleta opened this issue Mar 16, 2015 · 3 comments
Closed

cli.py should check_schema before using it. #208

Parakleta opened this issue Mar 16, 2015 · 3 comments
Labels
Enhancement Some new desired functionality

Comments

@Parakleta
Copy link

The documentation suggests "first verify that the provided schema is itself valid, since not doing so can lead to less obvious error messages and fail in less obvious or consistent ways" but the command line utility does not follow this advice.

If it is desirable to not recheck the schema on every run for performance reasons related to scripting it would be possible to instead check the schema just when the cli tool is called with no instances (which currently appears to be effectively a no-op), but I would prefer it on every run (since multiple instances can be provided in a single execution).

@Julian
Copy link
Member

Julian commented Mar 19, 2015

Yup, agreed. Any chance you'd be interested in a PR?

@Julian Julian added the Enhancement Some new desired functionality label Mar 19, 2015
@Parakleta
Copy link
Author

Not really. There are several different ways the issue could be resolved and I don't think it's my place to determine which of those methods is correct, especially since I have no particular understanding of this project, or more than a passing familiarity with Python.

For my purpose because I am calling the validator from other code as well I have changed the Validator.__init__ function, adding the line schema is not self.META_SCHEMA and self.check_schema(schema). I chose this because it is more convenient for me to know that any validator object has a legal schema attached, but I don't know how this fits into the scope of your project.

Going forward I think I am likely to abandon JSON schema in general anyway since I need more expressive power, meaning either XSD1.1 or a Lua DSL.

@wspeirs
Copy link

wspeirs commented Sep 28, 2016

Fixed in #297

@Julian Julian closed this as completed May 20, 2017
Julian added a commit that referenced this issue Dec 8, 2017
86f965e Merge pull request #209 from json-schema-org/refactor-format
f056cb7 fix: incorrect relative-json-pointer test, closes #208
814eb16 refactor: split format.json to multiple files, closes #162
870b9f7 Merge pull request #207 from json-schema-org/draft-7-ajv
3d9830a feat: test draft-7 with Ajv
9ce7b4c Merge pull request #200 from handrews/draft-07
cf6e663 Apparently descriptions must be < 60 chars
1042cd6 Update draft coverage information
0680b46 Restore regex format test from draft-03
f58637d Basic relative json pointer tests for format
1b43ffa Partial IRI and IRI-reference test suite
9b020b8 Add idn-email and idn-hostname format tests
ca342c9 Add tests for "date" and "time" formats
0d64501 Tests for contentMediaType and contentEncoding
ea357f3 Update draft coverage information
321db9a Tests for if, then, and else keywords
dedd3f1 Unmodified copy of draft6 tests to draft7

git-subtree-dir: json
git-subtree-split: 86f965e53dda0b6c57e70ddd726243e1e061cf84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Some new desired functionality
Projects
None yet
Development

No branches or pull requests

3 participants