Json Schema file extension
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.
Related videos on Youtube
Comments
-
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 over 7 yearsAs 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 over 10 yearsI also use *.schema.json
-
Daniel Santos over 5 yearsI also also also use *.schema.json
-
Mark Amery over 5 yearsNo, HTML is not XML. There are lots and lots of differences.
-
awwright almost 5 yearsWell, 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 about 4 yearsI think you mean SGML, not UML.