Code Monkey home page Code Monkey logo

Comments (2)

handrews avatar handrews commented on May 22, 2024

Opinions on various points:

vars should allow schemas in addition to relative JSON Pointers

The vars section should not only describe how to resolve the variables from an instance, but also support validation of user-supplied data when resolving the templates in other ways. This should work as follows, taken from Riverbed Technology's service definition format which made extensive use of this mechanism:

An entry in the "vars" field can either adjust the starting point for that resolution through a relative JSON pointer, or provide a schema, indicating that the value must be provided from an external source. Any schema, whether implied through the resource's schema or given explicitly, must describe a type that can be resolved through the rules for that variable as described in the URI templates standard (RFC 6570). Otherwise the resulting behavior is undefined.

While we found it to be a best practice to always be able to fully resolve the self link from the instance data, it doesn't seem to be something that should be strictly required.

Legacy pre-processing rules

Toss them. They're ugly and confusing and not worth the burden of carrying them forwards. It's also not horribly difficult to migrate from them to vars. People who don't want to update them can keep using the Draft 04 meta-schema until they are ready to move forwards.

Templating $ref

No use case is given for this, and it introduces considerable complication. I move that this be dropped unless/until compelling use cases are identified. It clearly could do a lot of things, but it's not clear that those things are desirable.

from json-schema-spec.

handrews avatar handrews commented on May 22, 2024

Having split the most urgent portion of this out into #142, I am going to close this. It's an omnibus that is hard to discuss all at once.

Templating $ref is not something I have heard anyone else request. If someone wants that, please open it as its own issue. The question in that issue should just be whether to template $ref, yes or no. The question of whether templates use pre-processing, mapping, or some other mechanism should be decided separately and applied to all template uses (currently href and base, possibly also $ref and rel).

My comment tacked on more proposals about user input and validation. That's a complex topic, the requirements for which are being explored in #108 which is a better vehicle for the discussion (it's at least garnered a few comments, while this issue has not).

from json-schema-spec.

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.