Giter VIP home page Giter VIP logo

Comments (7)

Julian avatar Julian commented on May 10, 2024

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.

gazpachoking avatar gazpachoking commented on May 10, 2024

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.

Julian avatar Julian commented on May 10, 2024

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.

gazpachoking avatar gazpachoking commented on May 10, 2024

Hmm, draft 4 just says:

JSON Schema uses JSON Reference [json‑reference] as a mechanism for schema addressing.

from jsonschema.

gazpachoking avatar gazpachoking commented on May 10, 2024

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.

Julian avatar Julian commented on May 10, 2024

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.

gazpachoking avatar gazpachoking commented on May 10, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.