From 1d1c93d5a9011ecdf58a4952afcb5a1faff30e76 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Mon, 14 Feb 2022 10:45:18 +0100 Subject: specify full schema URL in instances --- api_mapping_description-1.schema.json | 10 ++++++++++ api_query_result-1.schema.json | 11 +++++------ api_resource_description-1.schema.json | 6 ++++++ api_source_description-1.schema.json | 8 +++++--- common_definitions-1.schema.json | 20 +------------------- package_source-1.schema.json | 8 +++++--- 6 files changed, 32 insertions(+), 31 deletions(-) diff --git a/api_mapping_description-1.schema.json b/api_mapping_description-1.schema.json index 6b0e723..e37dd00 100644 --- a/api_mapping_description-1.schema.json +++ b/api_mapping_description-1.schema.json @@ -7,5 +7,15 @@ "$ref": "./common_definitions-1.schema.json#/definitions/mapping_definition_base" }, { "$ref": "./common_definitions-1.schema.json#/definitions/item_definition" + }, { + "type": "object", + "required": ["$schema"], + "properties": { + "$schema": { + "description": "Mark this instance as conforming to mapping description schema 1.x", + "type": "string", + "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_mapping_description-1\\.([1-9][0-9]*\\.)*schema\\.json$" + } + } }] } diff --git a/api_query_result-1.schema.json b/api_query_result-1.schema.json index 62144dd..7de8f76 100644 --- a/api_query_result-1.schema.json +++ b/api_query_result-1.schema.json @@ -4,13 +4,12 @@ "title": "Query result", "description": "Object with a list of references to mappings that contain payloads for requested URL", "type": "object", - "required": [ - "api_schema_version", - "mappings" - ], + "required": ["$schema", "mappings"], "properties": { - "api_schema_version": { - "$ref": "./common_definitions-1.schema.json#/definitions/schema_version" + "$schema": { + "description": "Mark this instance as conforming to query result schema 1.x", + "type": "string", + "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_query_result-1\\.([1-9][0-9]*\\.)*schema\\.json$" }, "mappings": { "description": "References to mappings using at least one pattern that matches the requested URL", diff --git a/api_resource_description-1.schema.json b/api_resource_description-1.schema.json index 9e47a44..b6a32cd 100644 --- a/api_resource_description-1.schema.json +++ b/api_resource_description-1.schema.json @@ -9,7 +9,13 @@ "$ref": "./common_definitions-1.schema.json#/definitions/item_definition" }, { "type": "object", + "required": ["$schema"], "properties": { + "$schema": { + "description": "Mark this instance as conforming to resource description schema 1.x", + "type": "string", + "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_resource_description-1\\.([1-9][0-9]*\\.)*schema\\.json$" + }, "scripts": { "description": "Which files are resource's scripts and need to be installed", "$ref": "./common_definitions-1.schema.json#/definitions/file_ref_list_sha256", diff --git a/api_source_description-1.schema.json b/api_source_description-1.schema.json index c153d3a..7016b6d 100644 --- a/api_source_description-1.schema.json +++ b/api_source_description-1.schema.json @@ -5,7 +5,7 @@ "description": "Built description of a Hydrilla source package", "type": "object", "required": [ - "api_schema_version", + "$schema", "source_name", "source_copyright", "source_archives", @@ -13,8 +13,10 @@ "definitions" ], "properties": { - "api_schema_version": { - "$ref": "./common_definitions-1.schema.json#/definitions/schema_version" + "$schema": { + "description": "Mark this instance as conforming to source description schema 1.x", + "type": "string", + "pattern": "^https://hydrilla\\.koszko\\.org/schemas/api_source_description-1\\.([1-9][0-9]*\\.)*schema\\.json$" }, "source_name": { "$ref": "./common_definitions-1.schema.json#/definitions/source_name" diff --git a/common_definitions-1.schema.json b/common_definitions-1.schema.json index c47c7ab..dfe0cd8 100644 --- a/common_definitions-1.schema.json +++ b/common_definitions-1.schema.json @@ -18,17 +18,6 @@ }, "minItems": 1 }, - "schema_version": { - "description": "Which version of appropriate schema a JSON document conforms to (major number is assumed to be 1)", - "allOf": [{ - "$ref": "#definitions/version" - }, { - "type": "array", - "items": [{ - "const": 1 - }] - }] - }, "source_name": { "description": "Unique identifier of this source package", "type": "string", @@ -226,15 +215,8 @@ "item_definition": { "description": "Definition of a resource/mapping (fields specific to built definitions)", "type": "object", - "required": [ - "api_schema_version", - "source_name", - "source_copyright" - ], + "required": ["source_name", "source_copyright"], "properties": { - "api_schema_version": { - "$ref": "#/definitions/schema_version" - }, "source_name": { "$ref": "#/definitions/source_name" }, diff --git a/package_source-1.schema.json b/package_source-1.schema.json index fb2bfb7..e7e0064 100644 --- a/package_source-1.schema.json +++ b/package_source-1.schema.json @@ -5,15 +5,17 @@ "description": "Definition of a Hydrilla source package", "type": "object", "required": [ - "source_schema_version", + "$schema", "source_name", "copyright", "upstream_url", "definitions" ], "properties": { - "source_schema_version": { - "$ref": "./common_definitions-1.schema.json#/definitions/schema_version" + "$schema": { + "description": "Mark this instance as conforming to package source schema 1.x", + "type": "string", + "pattern": "^https://hydrilla\\.koszko\\.org/schemas/package_source-1\\.([1-9][0-9]*\\.)*schema\\.json$" }, "source_name": { "$ref": "./common_definitions-1.schema.json#/definitions/source_name" -- cgit v1.2.3