Comments (7)
Not saying we shouldn't do this as an optimization, but doesn't it say something like "when ref is encountered", which sounded like it meant whenever you happen to see the reference while you are validating that schema?
from jsonschema.
I was thinking of this line
Any members other than "$ref" in a JSON Reference object SHALL be ignored.
From here: http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03
from jsonschema.
That line governs JSON Reference. It means that if you're resolving JSON References you shouldn't fail to resolve because the reference has other members.
The relevant line covering what to do when validating JSON Schemas is:
When a validator encounters this attribute, it SHOULD replace the current schema with the schema referenced by the value's URI (if known and available) and re- validate the instance.
From http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.28
from jsonschema.
Hmm, draft 4 just says:
JSON Schema uses JSON Reference [json‑reference] as a mechanism for schema addressing.
from jsonschema.
Oh, and the 're- validate the instance' bit from draft 3 implies that any of the keywords you have already validated should be thrown out.
from jsonschema.
I don't think that means anything has changed, it just means either it was
left out accidentally or deemed unnecessary.
I'm also not sure that the intent of "re-validate" is to throw out what was
already seen, if it meant that out should have just mandated ignoring
everything but ref and said exactly those words.
Either way, if you want to add the pre-check I'm fine with that, since from
my standpoint even if allowing validating the other stuff is allowed, it's
not mandated and isn't something someone writing a schema should at all be
relying on, so it's a reasonable (although probably small) optimization.
Hmm, draft 4 just says:
JSON Schema uses JSON Reference [json‑reference] as a mechanism for schema
addressing.
—
Reply to this email directly or view it on GitHub.
from jsonschema.
Yeah, I think ultimately there aren't going to be any schemas that have stuff other than the $ref, unless they are written wrong, so it doesn't much matter. But I think @fge has also mentioned the intent of the spec was for other properties to be ignored when $ref is present.
from jsonschema.
Related Issues (20)
- Which is the last version not requiring Rust via its dependencies?
- Migrating From RefResolver, unable to resolve $ref
- Feature request: Add support for a second message attribute on errors which is guaranteed not to include the failing instance HOT 5
- Python NaN validates against all numeric limits, and shouldn't HOT 2
- validating nan in an enum is no longer supported HOT 1
- Need a custom ref resolver
- Support custom Registry for meta schema in check_schema HOT 4
- `"format":"date-time"` not working HOT 6
- The latest version is slower than 3.2.0 validator HOT 5
- Validation error messages changed after upgrading jsonschema version from 3.2.0 to 4.21.1 HOT 5
- multipleOf fails to validate that 4.02 is a multiple of 0.01 due to floating point math HOT 1
- Unexpected KeyError while running test suite inside GitLab Worker HOT 3
- Enhancing the multipleOf Validator for Improved Decimal Handling in jsonschema HOT 1
- @FormatChecker.checks decorator not a classmethod HOT 1
- RefResolver deprecation docs are confusing and do not explain how to replace a very simple usage (a RefResolver which just specifies a base_uri) HOT 1
- Using the copy button of the code block in the README results in error "zsh: command not found: $" HOT 2
- Support installation via Homebrew HOT 1
- Improve `best_match` when used with applicators HOT 2
- Documentation is out to date HOT 6
- Error importing jsonschema after release 4.22.0 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsonschema.