summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Henrie <alexhenrie24@gmail.com>2021-05-28 12:17:27 -0600
committerDavid Faure <faure@kde.org>2021-05-28 19:59:36 +0000
commit758bc44aea72ebde6e0819b48769e0fbb1f83eba (patch)
treee2999ab065ffdc2c21fe2b650c4da26ca7c6b5d4
parent19ae0236be95b168d3049907cdd0c521f8dc45a3 (diff)
downloadshared-mime-info-758bc44aea72ebde6e0819b48769e0fbb1f83eba.tar.gz
application/schema+json: new type
JSON Schema files are distinguished from other JSON files by a "$schema" property which is typically at the beginning of the file. https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00
-rw-r--r--data/freedesktop.org.xml.in11
-rw-r--r--tests/mime-detection/list1
-rw-r--r--tests/mime-detection/schema.json6
3 files changed, 18 insertions, 0 deletions
diff --git a/data/freedesktop.org.xml.in b/data/freedesktop.org.xml.in
index 0592a520..42480371 100644
--- a/data/freedesktop.org.xml.in
+++ b/data/freedesktop.org.xml.in
@@ -2592,6 +2592,17 @@ command to generate the output files.
<generic-icon name="text-x-script"/>
<glob pattern="*.jsonld"/>
</mime-type>
+ <mime-type type="application/schema+json">
+ <comment>JSON schema</comment>
+ <sub-class-of type="application/json"/>
+ <generic-icon name="text-x-script"/>
+ <magic priority="80">
+ <match type="string" value="{" offset="0">
+ <match type="string" value="&quot;$schema&quot;:" offset="1:256"/>
+ </match>
+ </magic>
+ <glob pattern="*.json"/>
+ </mime-type>
<mime-type type="application/x-ipynb+json">
<comment>Jupyter notebook document</comment>
<sub-class-of type="application/json"/>
diff --git a/tests/mime-detection/list b/tests/mime-detection/list
index 9f110da9..768a396e 100644
--- a/tests/mime-detection/list
+++ b/tests/mime-detection/list
@@ -298,6 +298,7 @@ webfinger.jrd application/jrd+json ox
my-data.json-patch application/json-patch+json ox
# Copied from http://www.w3.org/TR/json-ld/
json-ld-full-iri.jsonld application/ld+json ox
+schema.json application/schema+json x
test.ipynb application/x-ipynb+json
test-reordered.ipynb application/x-ipynb+json ox
test.cs text/x-csharp ox
diff --git a/tests/mime-detection/schema.json b/tests/mime-detection/schema.json
new file mode 100644
index 00000000..5ee3ed6c
--- /dev/null
+++ b/tests/mime-detection/schema.json
@@ -0,0 +1,6 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "foo": {"type": "string"}
+ }
+}