Json Schema file extension

39,450

Solution 1

From Gary Court:

I personally use .schema.json, but there is no official file extension. The official mime type however is "application/schema+json".

Solution 2

According to the last draft (v4), there is not a new extension proposed for files storing json-schemas. .json extension is used profusely within that document. .json is also the preferred extension in validators (PHP, Ruby, Python).

So I think that .json should be the preferred option in absence of an official/standard new extension.

Solution 3

From https://json-schema.org/understanding-json-schema/basics.html#id3

Since JSON Schema is itself JSON, it’s not always easy to tell when something is JSON Schema or just an arbitrary chunk of JSON. The $schema keyword is used to declare that something is JSON Schema. It’s generally good practice to include it, though it is not required.

So you can use .json as the file extension for JSON schema but maybe with a $schema keyword (although optional) for better distinction.

Solution 4

I've started using .jschema after I had a run-in with an extension-based JSON Schema parser that automatically added id's to external RAML examples which are also .json files.

They are a specific format, after all. HTML is XML, which is UML, and we use a different file extension for each of those.

Share:
39,450

Related videos on Youtube

Fresa
Author by

Fresa

Architect, designer and developer

Updated on March 22, 2022

Comments

  • Fresa
    Fresa about 2 years

    Is there any naming convention for a json schema file extension? XML has .xsd (XML Schema Definition), what should json schema files have, .jsd (JSON Schema Definition)?

    • Relequestual
      Relequestual over 7 years
      As someone working on the JSON Schema specification currently, it's not really something that's been considered. If you think it should be, feel free to open an issue on the github repo.
  • jasonkarns
    jasonkarns over 10 years
    I also use *.schema.json
  • Daniel Santos
    Daniel Santos over 5 years
    I also also also use *.schema.json
  • Mark Amery
    Mark Amery over 5 years
    No, HTML is not XML. There are lots and lots of differences.
  • awwright
    awwright almost 5 years
    Well, as of HTML5, HTML is a vocabulary defined for two related media types: text/html (which is a complicated parser not based on anything), and application/xhtml+xml (which is standard XML).
  • Daniel Schilling
    Daniel Schilling about 4 years
    I think you mean SGML, not UML.