Skip to content

Commit

Permalink
Add JSON Schema Draft 4
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti committed Jan 17, 2025
1 parent 57b0e23 commit 0ed13ae
Show file tree
Hide file tree
Showing 7 changed files with 366 additions and 151 deletions.
1 change: 1 addition & 0 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ jsonschema-2020-12 https://github.com/json-schema-org/json-schema-spec 769daad75
jsonschema-2019-09 https://github.com/json-schema-org/json-schema-spec 41014ea723120ce70b314d72f863c6929d9f3cfd
jsonschema-draft7 https://github.com/json-schema-org/json-schema-spec 567f768506aaa33a38e552c85bf0586029ef1b32
jsonschema-draft6 https://github.com/json-schema-org/json-schema-spec 59ed5f6fc6f6386e23ca51d7f31d7fe9cf696713
jsonschema-draft4 https://github.com/json-schema-org/json-schema-spec dba92b702c94858162f653590230e7573c8b7dd0
openapi https://github.com/OAI/OpenAPI-Specification 3.1.1
155 changes: 4 additions & 151 deletions configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,157 +127,6 @@
}
},
"schemas": {
"nasa/gcn/v4.2.0": {
"base": "https://gcn.nasa.gov/schema/v4.2.0/gcn",
"path": "./vendor/nasa-gcn-4-2-0"
},
"nasa/gcn/v4.1.0": {
"base": "https://gcn.nasa.gov/schema/v4.1.0/gcn",
"path": "./vendor/nasa-gcn-4-1-0"
},
"nasa/gcn/v4.0.0": {
"base": "https://gcn.nasa.gov/schema/v4.0.0/gcn",
"path": "./vendor/nasa-gcn-4-0-0"
},
"nasa/gcn/v3.0.0": {
"base": "https://gcn.nasa.gov/schema/v3.0.0/gcn",
"path": "./vendor/nasa-gcn-3-0-0"
},
"nasa/gcn/v2.0.0": {
"base": "https://gcn.nasa.gov/schema/v2.0.0/gcn",
"path": "./vendor/nasa-gcn-2-0-0"
},
"nasa/gcn/v1.0.0": {
"base": "https://gcn.nasa.gov/schema/v1.0.0/gcn",
"path": "./vendor/nasa-gcn-1-0-0"
},
"ossf/osv/v1.6.7": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-6-7"
},
"ossf/osv/v1.6.6": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-6-6"
},
"ossf/osv/v1.6.5": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-6-5"
},
"ossf/osv/v1.6.4": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-6-4"
},
"ossf/osv/v1.6.3": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-6-3"
},
"ossf/osv/v1.6.2": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-6-2"
},
"ossf/osv/v1.6.1": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-6-1"
},
"ossf/osv/v1.6.0": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-6-0"
},
"ossf/osv/v1.5.0": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-5-0"
},
"ossf/osv/v1.4.0": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-4-0/validation"
},
"ossf/osv/v1.3.1": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-3-1/validation"
},
"ossf/osv/v1.3.0": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-3-0/validation"
},
"ossf/osv/v1.2.0": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-2-0/validation"
},
"ossf/osv/v1.1.0": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-1-0/validation"
},
"ossf/osv/v1.0.0": {
"base": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation",
"path": "./vendor/osv-schema-1-0-0/validation"
},
"manfred/mac/v0.6": {
"base": "http://github.com/manfred/mac",
"path": "./vendor/manfred-mac-0-6"
},
"manfred/mac/v0.5": {
"base": "http://github.com/manfred/mac",
"path": "./vendor/manfred-mac-0-5"
},
"manfred/mac/v0.4": {
"base": "http://github.com/manfred/mac",
"path": "./vendor/manfred-mac-0-4"
},
"manfred/mac/v0.3": {
"base": "http://github.com/manfred/mac",
"path": "./vendor/manfred-mac-0-3"
},
"krakend": {
"base": "https://www.krakend.io/schema",
"path": "./vendor/krakend"
},
"movielabs/omc": {
"base": "https://movielabs.com/omc/json/schema",
"path": "./vendor/movielabs-omc-2-6"
},
"octue/power-curve/v1.0.0.alpha-1": {
"base": "https://jsonschema.registry.octue.com/octue/power-curves",
"path": "./vendor/octue-power-curve/power-curve-schema"
},
"usnistgov/mgi/2022-08": {
"base": "https://github.com/usnistgov/mgi-json-schema",
"path": "./vendor/usnistgov-mgi-2022-08"
},
"cloudevents/v1.0.2": {
"base": "https://github.com/cloudevents/spec",
"path": "./vendor/cloudevents-1-0-2/cloudevents/formats"
},
"cloudevents/v1.0.1": {
"base": "https://github.com/cloudevents/spec",
"path": "./vendor/cloudevents-1-0-1"
},
"cloudevents/v1.0.0": {
"base": "https://github.com/cloudevents/spec",
"path": "./vendor/cloudevents-1-0-0",
"defaultDialect": "http://json-schema.org/draft-07/schema#"
},
"riskine/global-insurance/v1.0.0/core": {
"base": "https://ontology.riskine.com",
"path": "./vendor/riskine-ontology-1-0-0/schemas/core",
"defaultDialect": "http://json-schema.org/draft-07/schema#"
},
"riskine/global-insurance/v1.0.0/products": {
"base": "https://ontology.riskine.com",
"path": "./vendor/riskine-ontology-1-0-0/schemas/products",
"defaultDialect": "http://json-schema.org/draft-07/schema#"
},
"jsr": {
"base": "https://jsr.io/schema",
"path": "./vendor/jsr"
},
"jsonschema/2020-12": {
"base": "https://json-schema.org/draft/2020-12",
"path": "./vendor/jsonschema-2020-12"
},
"jsonschema/2019-09": {
"base": "https://json-schema.org/draft/2019-09",
"path": "./vendor/jsonschema-2019-09"
},
"jsonschema/draft7": {
"base": "http://json-schema.org/draft-07",
"path": "./vendor/jsonschema-draft7"
Expand All @@ -286,6 +135,10 @@
"base": "http://json-schema.org/draft-06",
"path": "./vendor/jsonschema-draft6"
},
"jsonschema/draft4": {
"base": "http://json-schema.org/draft-04",
"path": "./vendor/jsonschema-draft4"
},
"openapi/v1.2": {
"base": "https://raw.githubusercontent.com/oai/openapi-specification/master/schemas/v1.2",
"path": "./vendor/openapi/schemas/v1.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 73a78fb9ed0fd2a6ad81b8b9ee17a35d57b58529 Mon Sep 17 00:00:00 2001
From: Juan Cruz Viotti <[email protected]>
Date: Fri, 17 Jan 2025 14:16:29 -0400
Subject: [PATCH] Fix `links` not adhering to its meta-schema given invalid
`dependencies`

In Draft 4, `dependencies` is either a schema or an array of unique
strings.

See: https://json-schema.org/draft-04/draft-fge-json-schema-validation-00#rfc.section.5.4.5
See: https://www.learnjsonschema.com/draft4/validation/dependencies/
Signed-off-by: Juan Cruz Viotti <[email protected]>
---
links.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/links.json b/links.json
index de272cc..5c0d30d 100644
--- a/links.json
+++ b/links.json
@@ -36,6 +36,6 @@
"required" : ["rel", "href"],

"dependencies" : {
- "enctype" : "method"
+ "enctype" : ["method"]
}
}
\ No newline at end of file
--
2.48.0

3 changes: 3 additions & 0 deletions vendor/jsonschema-draft4.mask
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jsonschema-core.xml
jsonschema-hyperschema.xml
jsonschema-validation.xml
136 changes: 136 additions & 0 deletions vendor/jsonschema-draft4/hyper-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"$schema": "http://json-schema.org/draft-04/hyper-schema#",
"id": "http://json-schema.org/draft-04/hyper-schema#",
"title": "JSON Hyper-Schema",
"allOf": [
{"$ref": "http://json-schema.org/draft-04/schema#"}
],
"properties": {
"additionalItems": {
"anyOf": [
{"type": "boolean"},
{"$ref": "#"}
]
},
"additionalProperties": {
"anyOf": [
{"type": "boolean"},
{"$ref": "#"}
]
},
"dependencies": {
"additionalProperties": {
"anyOf": [
{"$ref": "#"},
{"type": "array"}
]
}
},
"items": {
"anyOf": [
{"$ref": "#"},
{"$ref": "#/definitions/schemaArray"}
]
},
"definitions": {
"additionalProperties": {"$ref": "#"}
},
"patternProperties": {
"additionalProperties": {"$ref": "#"}
},
"properties": {
"additionalProperties": {"$ref": "#"}
},
"allOf": {"$ref": "#/definitions/schemaArray"},
"anyOf": {"$ref": "#/definitions/schemaArray"},
"oneOf": {"$ref": "#/definitions/schemaArray"},
"not": { "$ref": "#" },

"links": {
"type": "array",
"items": {"$ref": "#/definitions/linkDescription"}
},
"fragmentResolution": {
"type": "string"
},
"media": {
"type": "object",
"properties": {
"type": {
"description": "A media type, as described in RFC 2046",
"type": "string"
},
"binaryEncoding": {
"description": "A content encoding scheme, as described in RFC 2045",
"type": "string"
}
}
},
"pathStart": {
"description": "Instances' URIs must start with this value for this schema to apply to them",
"type": "string",
"format": "uri"
}
},
"definitions": {
"schemaArray": {
"type": "array",
"items": {"$ref": "#"}
},
"linkDescription": {
"title": "Link Description Object",
"type": "object",
"required": ["href", "rel"],
"properties": {
"href": {
"description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing",
"type": "string"
},
"rel": {
"description": "relation to the target resource of the link",
"type": "string"
},
"title": {
"description": "a title for the link",
"type": "string"
},
"targetSchema": {
"description": "JSON Schema describing the link target",
"$ref": "#"
},
"mediaType": {
"description": "media type (as defined by RFC 2046) describing the link target",
"type": "string"
},
"method": {
"description": "method for requesting the target of the link (e.g. for HTTP this might be \"GET\" or \"DELETE\")",
"type": "string"
},
"encType": {
"description": "The media type in which to submit data along with the request",
"type": "string",
"default": "application/json"
},
"schema": {
"description": "Schema describing the data to submit along with the request",
"$ref": "#"
}
}
},
"readOnly": {
"description": "If true, indicates that the value of this property is controlled by the server.",
"type": "boolean",
"default": false
}
},
"links": [
{
"rel": "self",
"href": "{+id}"
},
{
"rel": "full",
"href": "{+($ref)}"
}
]
}
41 changes: 41 additions & 0 deletions vendor/jsonschema-draft4/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema" : "http://json-schema.org/draft-04/hyper-schema#",
"id" : "http://json-schema.org/draft-04/links#",
"type" : "object",

"properties" : {
"rel" : {
"type" : "string"
},

"href" : {
"type" : "string"
},

"template" : {
"type" : "string"
},

"targetSchema" : {"$ref" : "http://json-schema.org/draft-04/hyper-schema#"},

"method" : {
"type" : "string",
"default" : "GET"
},

"enctype" : {
"type" : "string"
},

"properties" : {
"type" : "object",
"additionalProperties" : {"$ref" : "http://json-schema.org/draft-04/hyper-schema#"}
}
},

"required" : ["rel", "href"],

"dependencies" : {
"enctype" : ["method"]
}
}
Loading

0 comments on commit 0ed13ae

Please sign in to comment.