Coder Social home page Coder Social logo

Comments (2)

jdesrosiers avatar jdesrosiers commented on June 19, 2024 1

The short answer is that it doesn't matter. Use whatever you like.

That said, keep in mind that schema identifiers can't be relative as they are in your example. Whether or not I would use an extension depends on the URI scheme being used. If using http(s):, I wouldn't use an extension https://example.com/schemas/address) because that's the convention for the http(s): URI scheme.

However, what I prefer is to not use $id and allow the file's location on the file system to be the be the schema's identifier (file:///path/to/schema/address.schema.json). In this case, the identifier includes the extension because the file has an extension. References to this schema are file system relative, so you'll see references like, ./address.schema.json for this schema.

from json-schema-spec.

gregsdennis avatar gregsdennis commented on June 19, 2024 1

@andriy-dmytruk, to clarify, the JSON Schema specification explicitly recommends in section 8.2.1.1 that $id be included with a fully-qualified (absolute), fragment-less URI to serve as a base identifier.

Self identification holds the highest priority according to the URI specification, section 5.1, whereas file location holds the second lowest.

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.