diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..b6438fa --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "json-schema-spec"] + path = json-schema-spec/2020-12 + url = ../../json-schema-org/json-schema-spec.git +[submodule "json-schema-spec_2019-09"] + path = json-schema-spec/2019-09 + url = ../../json-schema-org/json-schema-spec.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 8847ba3..fdec7d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.19) # CMake version compatibility # TODO: Remove when bumping cmake >= 3.25 if (POLICY CMP0140) @@ -151,6 +151,9 @@ add_subdirectory(src) # Enable examples +# Convert meta-schema into strings and include into build +add_subdirectory(json-schema-spec) + # Enable testings if (JSON_VALIDATOR_BUILD_TESTS) enable_testing() @@ -161,7 +164,6 @@ if (JSON_VALIDATOR_BUILD_EXAMPLES) add_subdirectory(example) endif () - #[==============================================================================================[ # Install or Export # ]==============================================================================================] diff --git a/README.md b/README.md index 93751e7..993db75 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This is a C++ library for validating JSON documents based on a [JSON Schema](http://json-schema.org/) which itself should validate with -[draft-7 of JSON Schema Validation](http://json-schema.org/schema). +[draft 2020-12 of JSON Schema Validation](http://json-schema.org/schema). First a disclaimer: *It is work in progress and contributions or hints or discussions are welcome.* @@ -24,7 +24,7 @@ Although significant changes have been done for the 2nd version (a complete rewrite) the API is compatible with the 1.0.0 release. Except for the namespace which is now `nlohmann::json_schema`. -Version **2** supports JSON schema draft 7, whereas 1 was supporting draft 4 +Version **2** supports JSON schema draft 2020-12, whereas 1 was supporting draft 4 only. Please update your schemas. The primary change in 2 is the way a schema is used. While in version 1 the schema was @@ -170,7 +170,7 @@ using nlohmann::json_schema::json_validator; // The schema is defined based upon a string literal static json person_schema = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "title": "A person", "properties": { "name": { @@ -314,7 +314,7 @@ using nlohmann::json_schema::json_validator; static const json rectangle_schema = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "title": "A rectangle", "properties": { "width": { @@ -353,7 +353,7 @@ int main() The example above will output the specified default values `{"height":10,"width":20}` to stdout. -> Note that the default value specified in a `$ref` may be overridden by the current instance location. Also note that this behavior will break draft-7, but it is compliant to newer drafts (e.g. `2019-09` or `2020-12`). +> Note that the default value specified in a `$ref` may be overridden by the current instance location. Also note that this behavior will break draft 2020-12, but it is compliant to newer drafts (e.g. `2019-09` or `2020-12`). # Contributing diff --git a/example/format.cpp b/example/format.cpp index 40e6445..daf9b7c 100644 --- a/example/format.cpp +++ b/example/format.cpp @@ -8,7 +8,7 @@ using nlohmann::json_schema::json_validator; // The schema is defined based upon a string literal static json uri_schema = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "myUri": { diff --git a/example/readme.cpp b/example/readme.cpp index 45f4d35..9acc59b 100644 --- a/example/readme.cpp +++ b/example/readme.cpp @@ -9,7 +9,7 @@ using nlohmann::json_schema::json_validator; // The schema is defined based upon a string literal static json person_schema = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "title": "A person", "properties": { "name": { diff --git a/json-schema-spec/2019-09 b/json-schema-spec/2019-09 new file mode 160000 index 0000000..c8eb3d3 --- /dev/null +++ b/json-schema-spec/2019-09 @@ -0,0 +1 @@ +Subproject commit c8eb3d320f60eca7cfb18da25337a426ceb40eaa diff --git a/json-schema-spec/2020-12 b/json-schema-spec/2020-12 new file mode 160000 index 0000000..0d2e454 --- /dev/null +++ b/json-schema-spec/2020-12 @@ -0,0 +1 @@ +Subproject commit 0d2e45422eda1dd5d3eb76905cb816b612d63a5b diff --git a/json-schema-spec/CMakeLists.txt b/json-schema-spec/CMakeLists.txt new file mode 100644 index 0000000..8a4a59b --- /dev/null +++ b/json-schema-spec/CMakeLists.txt @@ -0,0 +1,44 @@ +#[==============================================================================================[ +# Meta-schema Generation # +]==============================================================================================] + +function (addSchemaFileToBuild META_SCHEMA_PATH) + file(READ ${META_SCHEMA_PATH} FILE_CONTENT) + string(JSON META_SCHEMA_ID GET ${FILE_CONTENT} "$id") + string(REPLACE "(" "-^-(" FILE_CONTENT "${FILE_CONTENT}") # work around the reality that there may be '(' within strings + string(REPLACE ")" ")-^-" FILE_CONTENT "${FILE_CONTENT}") # work around the reality that there may be ')' within strings + #string(REPLACE "\n" ")\"\nR\"(" FILE_CONTENT "${FILE_CONTENT}") # break lines into separate strings so that they are not too long for VS + set(SOURCES ${SOURCES} PARENT_SCOPE) + file (APPEND ${SCHEMA_CPP_FILE_NAME} " {\"${META_SCHEMA_ID}\",\nR\"(") + file (APPEND ${SCHEMA_CPP_FILE_NAME} ${FILE_CONTENT}) + file (APPEND ${SCHEMA_CPP_FILE_NAME} ")\"_json},\n") +endfunction() + +# this logic is such that the schema header file will only be generated once; until a "clean" +set(SCHEMA_BASE_FILE_NAME builtin_schema_map) +set(SCHEMA_BASE_FILE_PATH ${CMAKE_CURRENT_BINARY_DIR}/${SCHEMA_BASE_FILE_NAME}) +set(SCHEMA_HEADER_FILE_NAME ${SCHEMA_BASE_FILE_PATH}.h) +set(SCHEMA_CPP_FILE_NAME ${SCHEMA_BASE_FILE_PATH}.cpp) +if (EXISTS ${SCHEMA_HEADER_FILE_NAME}) + message("Not re-generating meta schema source files") +else() + file (WRITE ${SCHEMA_HEADER_FILE_NAME} "#include \n#include \n#include \nnamespace nlohmann {\n namespace json_schema {\n const extern std::map builtin_schema_map;\n }\n}\n") + file (WRITE ${SCHEMA_CPP_FILE_NAME} "#include \"${SCHEMA_BASE_FILE_NAME}.h\"\nnamespace nlohmann {\n namespace json_schema {\n const std::map builtin_schema_map = {\n") + file (GLOB META_SCHEMA_PATHS + 2019-09/meta/*.json + 2020-12/meta/*.json + ) + LIST(APPEND META_SCHEMA_PATHS + 2019-09/schema.json + 2020-12/schema.json + ) + message("META_SCHEMA_PATHS = ${META_SCHEMA_PATHS}") + foreach(ext_json_path ${META_SCHEMA_PATHS}) + addSchemaFileToBuild(${ext_json_path} APPEND) # subsequent invocations of addSchemaFileToBuild(), use APPEND + endforeach() + file (APPEND ${SCHEMA_CPP_FILE_NAME} " };\n }\n}\n") +endif() + +target_sources(nlohmann_json_schema_validator PRIVATE ${SCHEMA_CPP_FILE_NAME}) +target_include_directories(nlohmann_json_schema_validator PRIVATE ${CMAKE_BINARY_DIR}/json-schema-spec) + diff --git a/json-schema-spec/README.md b/json-schema-spec/README.md new file mode 100644 index 0000000..5d645c7 --- /dev/null +++ b/json-schema-spec/README.md @@ -0,0 +1,11 @@ +# JSON Schema Spec + +This directory contains several dialects of the JSON, also known +as meta-schema. +This is done using git submodules, so that the upstream version +can be tracked and updated easily. + +The `2019-09` dialect is not really supported, nor is it intended +to be. +However, it is included here as an example of how multiple dialects +will be supported, looking forward to the next release. diff --git a/schema b/schema deleted file mode 100644 index 5bee90e..0000000 --- a/schema +++ /dev/null @@ -1,168 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://json-schema.org/draft-07/schema#", - "title": "Core schema meta-schema", - "definitions": { - "schemaArray": { - "type": "array", - "minItems": 1, - "items": { "$ref": "#" } - }, - "nonNegativeInteger": { - "type": "integer", - "minimum": 0 - }, - "nonNegativeIntegerDefault0": { - "allOf": [ - { "$ref": "#/definitions/nonNegativeInteger" }, - { "default": 0 } - ] - }, - "simpleTypes": { - "enum": [ - "array", - "boolean", - "integer", - "null", - "number", - "object", - "string" - ] - }, - "stringArray": { - "type": "array", - "items": { "type": "string" }, - "uniqueItems": true, - "default": [] - } - }, - "type": ["object", "boolean"], - "properties": { - "$id": { - "type": "string", - "format": "uri-reference" - }, - "$schema": { - "type": "string", - "format": "uri" - }, - "$ref": { - "type": "string", - "format": "uri-reference" - }, - "$comment": { - "type": "string" - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "default": true, - "readOnly": { - "type": "boolean", - "default": false - }, - "examples": { - "type": "array", - "items": true - }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "number" - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "number" - }, - "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, - "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, - "pattern": { - "type": "string", - "format": "regex" - }, - "additionalItems": { "$ref": "#" }, - "items": { - "anyOf": [ - { "$ref": "#" }, - { "$ref": "#/definitions/schemaArray" } - ], - "default": true - }, - "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, - "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "contains": { "$ref": "#" }, - "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, - "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, - "required": { "$ref": "#/definitions/stringArray" }, - "additionalProperties": { "$ref": "#" }, - "definitions": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "default": {} - }, - "properties": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "default": {} - }, - "patternProperties": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "propertyNames": { "format": "regex" }, - "default": {} - }, - "dependencies": { - "type": "object", - "additionalProperties": { - "anyOf": [ - { "$ref": "#" }, - { "$ref": "#/definitions/stringArray" } - ] - } - }, - "propertyNames": { "$ref": "#" }, - "const": true, - "enum": { - "type": "array", - "items": true, - "minItems": 1, - "uniqueItems": true - }, - "type": { - "anyOf": [ - { "$ref": "#/definitions/simpleTypes" }, - { - "type": "array", - "items": { "$ref": "#/definitions/simpleTypes" }, - "minItems": 1, - "uniqueItems": true - } - ] - }, - "format": { "type": "string" }, - "contentMediaType": { "type": "string" }, - "contentEncoding": { "type": "string" }, - "if": {"$ref": "#"}, - "then": {"$ref": "#"}, - "else": {"$ref": "#"}, - "allOf": { "$ref": "#/definitions/schemaArray" }, - "anyOf": { "$ref": "#/definitions/schemaArray" }, - "oneOf": { "$ref": "#/definitions/schemaArray" }, - "not": { "$ref": "#" } - }, - "default": true -} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7848554..7e08827 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,5 @@ target_sources(nlohmann_json_schema_validator PRIVATE smtp-address-validator.cpp - json-schema-draft7.json.cpp json-uri.cpp json-validator.cpp json-patch.cpp diff --git a/src/json-patch.cpp b/src/json-patch.cpp index 3203543..7916691 100644 --- a/src/json-patch.cpp +++ b/src/json-patch.cpp @@ -9,7 +9,7 @@ namespace // with fixes const nlohmann::json patch_schema = R"patch({ "title": "JSON schema for JSONPatch files", - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "type": "array", "items": { diff --git a/src/json-schema-draft7.json.cpp b/src/json-schema-draft7.json.cpp deleted file mode 100644 index b680e2c..0000000 --- a/src/json-schema-draft7.json.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/* - * JSON schema validator for JSON for modern C++ - * - * Copyright (c) 2016-2019 Patrick Boettcher . - * - * SPDX-License-Identifier: MIT - * - */ -#include - -namespace nlohmann -{ -namespace json_schema -{ - -json draft7_schema_builtin = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://json-schema.org/draft-07/schema#", - "title": "Core schema meta-schema", - "definitions": { - "schemaArray": { - "type": "array", - "minItems": 1, - "items": { "$ref": "#" } - }, - "nonNegativeInteger": { - "type": "integer", - "minimum": 0 - }, - "nonNegativeIntegerDefault0": { - "allOf": [ - { "$ref": "#/definitions/nonNegativeInteger" }, - { "default": 0 } - ] - }, - "simpleTypes": { - "enum": [ - "array", - "boolean", - "integer", - "null", - "number", - "object", - "string" - ] - }, - "stringArray": { - "type": "array", - "items": { "type": "string" }, - "uniqueItems": true, - "default": [] - } - }, - "type": ["object", "boolean"], - "properties": { - "$id": { - "type": "string", - "format": "uri-reference" - }, - "$schema": { - "type": "string", - "format": "uri" - }, - "$ref": { - "type": "string", - "format": "uri-reference" - }, - "$comment": { - "type": "string" - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "default": true, - "readOnly": { - "type": "boolean", - "default": false - }, - "examples": { - "type": "array", - "items": true - }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "number" - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "number" - }, - "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, - "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, - "pattern": { - "type": "string", - "format": "regex" - }, - "additionalItems": { "$ref": "#" }, - "items": { - "anyOf": [ - { "$ref": "#" }, - { "$ref": "#/definitions/schemaArray" } - ], - "default": true - }, - "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, - "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "contains": { "$ref": "#" }, - "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, - "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, - "required": { "$ref": "#/definitions/stringArray" }, - "additionalProperties": { "$ref": "#" }, - "definitions": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "default": {} - }, - "properties": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "default": {} - }, - "patternProperties": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "propertyNames": { "format": "regex" }, - "default": {} - }, - "dependencies": { - "type": "object", - "additionalProperties": { - "anyOf": [ - { "$ref": "#" }, - { "$ref": "#/definitions/stringArray" } - ] - } - }, - "propertyNames": { "$ref": "#" }, - "const": true, - "enum": { - "type": "array", - "items": true, - "minItems": 1, - "uniqueItems": true - }, - "type": { - "anyOf": [ - { "$ref": "#/definitions/simpleTypes" }, - { - "type": "array", - "items": { "$ref": "#/definitions/simpleTypes" }, - "minItems": 1, - "uniqueItems": true - } - ] - }, - "format": { "type": "string" }, - "contentMediaType": { "type": "string" }, - "contentEncoding": { "type": "string" }, - "if": { "$ref": "#" }, - "then": { "$ref": "#" }, - "else": { "$ref": "#" }, - "allOf": { "$ref": "#/definitions/schemaArray" }, - "anyOf": { "$ref": "#/definitions/schemaArray" }, - "oneOf": { "$ref": "#/definitions/schemaArray" }, - "not": { "$ref": "#" } - }, - "default": true -} )"_json; -} -} // namespace nlohmann diff --git a/src/json-validator.cpp b/src/json-validator.cpp index 62ce97c..d3e54e5 100644 --- a/src/json-validator.cpp +++ b/src/json-validator.cpp @@ -1409,7 +1409,7 @@ std::shared_ptr schema::make(json &schema, schema.erase(attr); - // special case where we break draft-7 and allow overriding of properties when a $ref is used + // special case where we break draft-7 and allow overriding of properties when a $ref is used <<-- might be out-of-date now that 2020-12 is used attr = schema.find("default"); if (attr != schema.end()) { // copy the referenced schema depending on the underlying type and modify the default value diff --git a/src/nlohmann/json-schema.hpp b/src/nlohmann/json-schema.hpp index 07befd3..38902d8 100644 --- a/src/nlohmann/json-schema.hpp +++ b/src/nlohmann/json-schema.hpp @@ -31,13 +31,15 @@ # error "expected existing NLOHMANN_JSON_VERSION_MAJOR preproc variable, please update to NLohmann's JSON 3.8.0" #endif +//#include "builtin_schema_map.h" + // make yourself a home - welcome to nlohmann's namespace namespace nlohmann { // A class representing a JSON-URI for schemas derived from // section 8 of JSON Schema: A Media Type for Describing JSON Documents -// draft-wright-json-schema-00 +// draft-wright-json-schema-00 <<-- might be incorrect now that 2020-12 is used // // New URIs can be derived from it using the derive()-method. // This is useful for resolving refs or subschema-IDs in json-schemas. @@ -127,8 +129,7 @@ public: namespace json_schema { - -extern json draft7_schema_builtin; +const extern std::map builtin_schema_map; typedef std::function schema_loader; typedef std::function format_checker; diff --git a/src/string-format-check.cpp b/src/string-format-check.cpp index ecc428f..cb34ed9 100644 --- a/src/string-format-check.cpp +++ b/src/string-format-check.cpp @@ -398,7 +398,7 @@ void default_string_format_check(const std::string &format, const std::string &v throw exception; } } else { - /* yet unsupported JSON schema draft 7 built-ins */ + /* as-of-yet unsupported JSON schema draft 2020-12 built-ins */ static const std::vector jsonSchemaStringFormatBuiltIns{ "date-time", "time", "date", "email", "idn-email", "hostname", "idn-hostname", "ipv4", "ipv6", "uri", "uri-reference", "iri", "iri-reference", "uri-template", "json-pointer", "relative-json-pointer", "regex"}; diff --git a/test/JSON-Schema-Test-Suite/CMakeLists.txt b/test/JSON-Schema-Test-Suite/CMakeLists.txt index 3d93b55..8444acc 100644 --- a/test/JSON-Schema-Test-Suite/CMakeLists.txt +++ b/test/JSON-Schema-Test-Suite/CMakeLists.txt @@ -1,6 +1,6 @@ set(JSON_SCHEMA_TEST_PREFIX "JSON-Suite" CACHE STRING "prefix for JSON-tests added to ctest") -set(DRAFT "draft7") +set(DRAFT "draft_2020-12") # find schema-test-suite find_path(JSON_SCHEMA_TEST_SUITE_PATH diff --git a/test/JSON-Schema-Test-Suite/json-schema-test.cpp b/test/JSON-Schema-Test-Suite/json-schema-test.cpp index deee4c8..ac13376 100644 --- a/test/JSON-Schema-Test-Suite/json-schema-test.cpp +++ b/test/JSON-Schema-Test-Suite/json-schema-test.cpp @@ -18,8 +18,8 @@ using nlohmann::json_schema::json_validator; static void loader(const json_uri &uri, json &schema) { - if (uri.location() == "http://json-schema.org/draft-07/schema") { - schema = nlohmann::json_schema::draft7_schema_builtin; + if (nlohmann::json_schema::builtin_schema_map.count(uri.location()) > 0) { + schema = nlohmann::json_schema::builtin_schema_map.at(uri.location()); return; } diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/additionalItems.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/additionalItems.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/additionalItems.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/additionalItems.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/additionalProperties.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/additionalProperties.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/additionalProperties.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/additionalProperties.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/allOf.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/allOf.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/allOf.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/allOf.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/anyOf.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/anyOf.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/anyOf.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/anyOf.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/boolean_schema.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/boolean_schema.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/boolean_schema.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/boolean_schema.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/const.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/const.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/const.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/const.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/contains.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/contains.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/contains.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/contains.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/default.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/default.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/default.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/default.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/definitions.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/definitions.json similarity index 79% rename from test/JSON-Schema-Test-Suite/tests/draft7/definitions.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/definitions.json index afe396e..c197946 100644 --- a/test/JSON-Schema-Test-Suite/tests/draft7/definitions.json +++ b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/definitions.json @@ -1,12 +1,12 @@ [ { "description": "validate definition against metaschema", - "schema": {"$ref": "http://json-schema.org/draft-07/schema#"}, + "schema": {"$schema": "http://json-schema.org/draft/2020-12/schema"}, "tests": [ { "description": "valid definition schema", "data": { - "definitions": { + "$defs": { "foo": {"type": "integer"} } }, @@ -15,7 +15,7 @@ { "description": "invalid definition schema", "data": { - "definitions": { + "$defs": { "foo": {"type": 1} } }, diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/dependencies.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/dependencies.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/dependencies.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/dependencies.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/enum.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/enum.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/enum.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/enum.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/exclusiveMaximum.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/exclusiveMaximum.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/exclusiveMaximum.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/exclusiveMaximum.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/exclusiveMinimum.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/exclusiveMinimum.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/exclusiveMinimum.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/exclusiveMinimum.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/format.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/format.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/format.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/format.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/id.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/id.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/id.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/id.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/if-then-else.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/if-then-else.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/if-then-else.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/if-then-else.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/infinite-loop-detection.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/infinite-loop-detection.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/infinite-loop-detection.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/infinite-loop-detection.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/items.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/items.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/items.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/items.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/maxItems.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/maxItems.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/maxItems.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/maxItems.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/maxLength.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/maxLength.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/maxLength.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/maxLength.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/maxProperties.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/maxProperties.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/maxProperties.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/maxProperties.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/maximum.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/maximum.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/maximum.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/maximum.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/minItems.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/minItems.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/minItems.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/minItems.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/minLength.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/minLength.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/minLength.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/minLength.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/minProperties.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/minProperties.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/minProperties.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/minProperties.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/minimum.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/minimum.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/minimum.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/minimum.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/multipleOf.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/multipleOf.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/multipleOf.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/multipleOf.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/not.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/not.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/not.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/not.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/oneOf.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/oneOf.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/oneOf.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/oneOf.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/bignum.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/bignum.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/bignum.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/bignum.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/content.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/content.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/content.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/content.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/ecmascript-regex.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/ecmascript-regex.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/ecmascript-regex.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/ecmascript-regex.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/float-overflow.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/float-overflow.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/float-overflow.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/float-overflow.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/date-time.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/date-time.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/date-time.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/date-time.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/date.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/date.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/date.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/date.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/email.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/email.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/email.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/email.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/hostname.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/hostname.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/hostname.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/hostname.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/idn-email.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/idn-email.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/idn-email.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/idn-email.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/idn-hostname.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/idn-hostname.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/idn-hostname.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/idn-hostname.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/ipv4.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/ipv4.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/ipv4.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/ipv4.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/ipv6.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/ipv6.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/ipv6.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/ipv6.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/iri-reference.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/iri-reference.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/iri-reference.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/iri-reference.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/iri.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/iri.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/iri.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/iri.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/json-pointer.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/json-pointer.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/json-pointer.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/json-pointer.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/regex.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/regex.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/regex.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/regex.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/relative-json-pointer.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/relative-json-pointer.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/relative-json-pointer.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/relative-json-pointer.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/time.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/time.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/time.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/time.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri-reference.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/uri-reference.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri-reference.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/uri-reference.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri-template.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/uri-template.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri-template.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/uri-template.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/uri.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/uri.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/format/uuid.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/uuid.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/format/uuid.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/format/uuid.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/non-bmp-regex.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/non-bmp-regex.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/non-bmp-regex.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/non-bmp-regex.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/optional/unicode.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/unicode.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/optional/unicode.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/optional/unicode.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/pattern.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/pattern.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/pattern.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/pattern.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/patternProperties.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/patternProperties.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/patternProperties.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/patternProperties.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/properties.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/properties.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/properties.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/properties.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/propertyNames.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/propertyNames.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/propertyNames.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/propertyNames.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/ref.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/ref.json similarity index 99% rename from test/JSON-Schema-Test-Suite/tests/draft7/ref.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/ref.json index 900ebb0..b394909 100644 --- a/test/JSON-Schema-Test-Suite/tests/draft7/ref.json +++ b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/ref.json @@ -213,7 +213,7 @@ }, { "description": "remote ref, containing refs itself", - "schema": {"$ref": "http://json-schema.org/draft-07/schema#"}, + "schema": {"$schema": "https://json-schema.org/draft/2020-12/schema"}, "tests": [ { "description": "remote ref valid", diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/refRemote.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/refRemote.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/refRemote.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/refRemote.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/required.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/required.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/required.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/required.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/type.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/type.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/type.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/type.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/uniqueItems.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/uniqueItems.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/uniqueItems.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/uniqueItems.json diff --git a/test/JSON-Schema-Test-Suite/tests/draft7/unknownKeyword.json b/test/JSON-Schema-Test-Suite/tests/draft_2020-12/unknownKeyword.json similarity index 100% rename from test/JSON-Schema-Test-Suite/tests/draft7/unknownKeyword.json rename to test/JSON-Schema-Test-Suite/tests/draft_2020-12/unknownKeyword.json diff --git a/test/errors.cpp b/test/errors.cpp index 3f95d15..0c62b6e 100644 --- a/test/errors.cpp +++ b/test/errors.cpp @@ -21,7 +21,7 @@ namespace // The schema is defined based upon a string literal static json person_schema = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "title": "A person", "properties": { "name": { diff --git a/test/issue-100/schema.json b/test/issue-100/schema.json index 3230714..7d7e07d 100644 --- a/test/issue-100/schema.json +++ b/test/issue-100/schema.json @@ -1,6 +1,6 @@ { "$id": "http://xxx.local/schemas/mySchema.json", - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { diff --git a/test/issue-101/schema.json b/test/issue-101/schema.json index 19fad64..6fb73f0 100644 --- a/test/issue-101/schema.json +++ b/test/issue-101/schema.json @@ -1,6 +1,6 @@ { "$id": "http://xxx.local/schemas/mySchema.json", - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { diff --git a/test/issue-12/schema.json b/test/issue-12/schema.json index ab104fa..75cefda 100644 --- a/test/issue-12/schema.json +++ b/test/issue-12/schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "properties": { "x": { "type": "integer", diff --git a/test/issue-149-entry-selection.cpp b/test/issue-149-entry-selection.cpp index c54c2c4..f6a8ba9 100644 --- a/test/issue-149-entry-selection.cpp +++ b/test/issue-149-entry-selection.cpp @@ -21,7 +21,7 @@ static int error_count; // The schema is defined based upon a string literal static json person_schema = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "type": "integer", "definitions": { "A": { diff --git a/test/issue-189-default-values.cpp b/test/issue-189-default-values.cpp index e7232d3..5e505d3 100644 --- a/test/issue-189-default-values.cpp +++ b/test/issue-189-default-values.cpp @@ -7,7 +7,7 @@ using nlohmann::json_schema::json_validator; static const json rectangle_schema = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "properties": { "width": { "$ref": "#/definitions/length", @@ -27,7 +27,7 @@ static const json rectangle_schema = R"( static const json quad_schema = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "properties": { "width": { "$ref": "#/properties/height", @@ -57,7 +57,7 @@ static const json quad_schema = R"( static const json default_schema = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "definitions": { "defaultLength": { "default": 5 diff --git a/test/issue-209/color.schema.json b/test/issue-209/color.schema.json index 2d4227b..f868b0c 100644 --- a/test/issue-209/color.schema.json +++ b/test/issue-209/color.schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "$id": "https://example.invalid/color.schema.json", "title": "color", "description": "X11/HTML/CSS color name as a JSON string", diff --git a/test/issue-209/entities.schema.json b/test/issue-209/entities.schema.json index 95828b8..969f278 100644 --- a/test/issue-209/entities.schema.json +++ b/test/issue-209/entities.schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "$id": "https://example.invalid/entities.schema.json", "title": "Entities", "type": "array", diff --git a/test/issue-229-oneof-default-values.cpp b/test/issue-229-oneof-default-values.cpp index 6bd6e8e..762a297 100644 --- a/test/issue-229-oneof-default-values.cpp +++ b/test/issue-229-oneof-default-values.cpp @@ -7,7 +7,7 @@ using nlohmann::json_schema::json_validator; static const json default_schema = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "type": "object", "oneOf": [ { diff --git a/test/issue-243-root-default-values.cpp b/test/issue-243-root-default-values.cpp index 34f0582..eeb2b25 100644 --- a/test/issue-243-root-default-values.cpp +++ b/test/issue-243-root-default-values.cpp @@ -7,7 +7,7 @@ using nlohmann::json_schema::json_validator; static const json root_default = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "properties": { "width": { "type": "integer" diff --git a/test/issue-25-default-values.cpp b/test/issue-25-default-values.cpp index 39a53df..781c040 100644 --- a/test/issue-25-default-values.cpp +++ b/test/issue-25-default-values.cpp @@ -6,7 +6,7 @@ using nlohmann::json_schema::json_validator; static const json person_schema = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "title": "A person", "properties": { "name": { diff --git a/test/issue-255-error-message-limit-precision.cpp b/test/issue-255-error-message-limit-precision.cpp index 5e8a6cf..6d3f72c 100644 --- a/test/issue-255-error-message-limit-precision.cpp +++ b/test/issue-255-error-message-limit-precision.cpp @@ -6,7 +6,7 @@ using nlohmann::json_schema::json_validator; static const json schema = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "$id": "arc.schema.json", "properties": { "angle": { diff --git a/test/issue-70-root-schema-constructor.cpp b/test/issue-70-root-schema-constructor.cpp index f19db3c..3e70187 100644 --- a/test/issue-70-root-schema-constructor.cpp +++ b/test/issue-70-root-schema-constructor.cpp @@ -21,7 +21,7 @@ namespace // The schema is defined based upon a string literal static json person_schema = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "title": "A person", "properties": { "name": { diff --git a/test/issue-70.cpp b/test/issue-70.cpp index bfac0a5..eb73f13 100644 --- a/test/issue-70.cpp +++ b/test/issue-70.cpp @@ -5,7 +5,7 @@ using nlohmann::json_schema::json_validator; static const json person_schema = R"( { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "title": "A person", "properties": { "name": { diff --git a/test/issue-9/bar.json b/test/issue-9/bar.json index 6f09818..04570af 100644 --- a/test/issue-9/bar.json +++ b/test/issue-9/bar.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "description": "Describes bar", "type": "object", "required": [ diff --git a/test/issue-9/base.json b/test/issue-9/base.json index 8faa877..950a56f 100644 --- a/test/issue-9/base.json +++ b/test/issue-9/base.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "description": "Describes foo", "type": "object", "allOf": [ diff --git a/test/issue-9/foo/baz/baz.json b/test/issue-9/foo/baz/baz.json index 1ed89d2..f92a50e 100644 --- a/test/issue-9/foo/baz/baz.json +++ b/test/issue-9/foo/baz/baz.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "description": "Describes baz", "$ref": "qux/qux.json" } diff --git a/test/issue-9/foo/baz/qux/qux.json b/test/issue-9/foo/baz/qux/qux.json index ebdc4c7..6a26cb6 100644 --- a/test/issue-9/foo/baz/qux/qux.json +++ b/test/issue-9/foo/baz/qux/qux.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "description": "Describes qux", "type": "object", "required": [ diff --git a/test/issue-9/foo/foo.json b/test/issue-9/foo/foo.json index 298f9c8..38f5e57 100644 --- a/test/issue-9/foo/foo.json +++ b/test/issue-9/foo/foo.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "description": "Describes foo", "$ref": "baz/baz.json" } diff --git a/test/issue-96/schema.json b/test/issue-96/schema.json index c608adf..2a0ff02 100644 --- a/test/issue-96/schema.json +++ b/test/issue-96/schema.json @@ -1,6 +1,6 @@ { "$id": "http://xxx.local/schemas/mySchema.json", - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft/2020-12/schema", "definitions": { "topDef": { "$id": "#topDef_ref", diff --git a/test/uri.cpp b/test/uri.cpp index 38c81ee..27526e3 100644 --- a/test/uri.cpp +++ b/test/uri.cpp @@ -91,15 +91,15 @@ int main(void) "", ""); - json_uri http("http://json-schema.org/draft-07/schema#"); + json_uri http("http://json-schema.org/draft/2020-12/schema"); paths(http, - "http://json-schema.org/draft-07/schema", - "http://json-schema.org/draft-07", + "http://json-schema.org/draft/2020-12/schema", + "http://json-schema.org/draft/2020-12", "http://json-schema.org"); pointer_plain_name(http, - "http://json-schema.org/draft-07/schema", - "http://json-schema.org/draft-07", + "http://json-schema.org/draft/2020-12/schema", + "http://json-schema.org/draft/2020-12", "http://json-schema.org"); return errors;