Skip to content

Commit

Permalink
Add experimental JSON schema
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Nelson <[email protected]>
  • Loading branch information
ajnelson-nist committed Dec 4, 2024
1 parent dcd7f5b commit f4ca52a
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
58 changes: 58 additions & 0 deletions data/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/make -f

# Portions of this file contributed by NIST are governed by the
# following statement:
#
# This software was developed at the National Institute of Standards
# and Technology by employees of the Federal Government in the course
# of their official duties. Pursuant to Title 17 Section 105 of the
# United States Code, this software is not subject to copyright
# protection within the United States. NIST assumes no responsibility
# whatsoever for its use by other parties, and makes no guarantees,
# expressed or implied, about its quality, reliability, or any other
# characteristic.
#
# We would appreciate acknowledgement if the software is used.

SHELL := /bin/bash

top_srcdir := ..

all: \
.geo.json.validation-ontology.done.log \
.geo.json.validation-schema-jsonld.done.log \
.geo.json.validation-schema-case-example.done.log

.geo.json.validation-ontology.done.log: \
$(top_srcdir)/.venv.done.log \
geo.json
source $(top_srcdir)/venv/bin/activate \
&& case_validate \
geo.json
touch $@

.geo.json.validation-schema-case-example.done.log: \
$(top_srcdir)/.venv.done.log \
geo.json \
case-example.schema.json
source $(top_srcdir)/venv/bin/activate \
&& check-jsonschema \
--schemafile case-example.schema.json \
geo.json
touch $@

.geo.json.validation-schema-jsonld.done.log: \
$(top_srcdir)/.venv.done.log \
geo.json
source $(top_srcdir)/venv/bin/activate \
&& check-jsonschema \
--schemafile https://raw.githubusercontent.com/json-ld/json-ld.org/refs/heads/main/schemas/jsonld-schema.json \
geo.json
touch $@

check: \
all

clean:
@rm -f \
.*.done.log
37 changes: 37 additions & 0 deletions data/case-example.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$id": "http://example.org/schema/case-example",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "Experimental schema for testing import strategies.",
"type": "object",
"properties": {
"@context": {
"type": "object"
},
"@graph": {
"type": "array",
"items": {
"type": "object",
"properties": {
"@type": {
"$ref": "#/$defs/@type"
}
}
}
}
},
"required": [
"@context",
"@graph"
],
"$defs": {
"@id": {
"type": "string"
},
"@type": {
"type": "array",
"items": {
"type": "string"
}
}
}
}

0 comments on commit f4ca52a

Please sign in to comment.