From 461b34ac7e5e4364bc6976c3c2e913b1a7f92d2d Mon Sep 17 00:00:00 2001 From: Matthew Adams Date: Wed, 20 Nov 2024 14:50:54 +0000 Subject: [PATCH] Added missing vocabulary spec to 2020-12 --- .../Draft2020212/vocabulary.feature | 58 +++++++++++++++++++ .../JsonSchemaOrgTestSuiteSelector.jsonc | 2 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 Solutions/Corvus.Json.Specs/Features/JsonSchema/Draft2020212/vocabulary.feature diff --git a/Solutions/Corvus.Json.Specs/Features/JsonSchema/Draft2020212/vocabulary.feature b/Solutions/Corvus.Json.Specs/Features/JsonSchema/Draft2020212/vocabulary.feature new file mode 100644 index 000000000..f10136dfc --- /dev/null +++ b/Solutions/Corvus.Json.Specs/Features/JsonSchema/Draft2020212/vocabulary.feature @@ -0,0 +1,58 @@ +@draft2020-12 + +Feature: vocabulary draft2020-12 + In order to use json-schema + As a developer + I want to support vocabulary in draft2020-12 + +Scenario Outline: schema that uses custom metaschema with with no validation vocabulary +/* Schema: +{ + "$id": "https://schema/using/no/validation", + "$schema": "http://localhost:1234/draft2020-12/metaschema-no-validation.json", + "properties": { + "badProperty": false, + "numberProperty": { + "minimum": 10 + } + } + } +*/ + Given the input JSON file "vocabulary.json" + And the schema at "#/0/schema" + And the input data at "" + And I generate a type for the schema + And I construct an instance of the schema type from the data + When I validate the instance + Then the result will be + + Examples: + | inputDataReference | valid | description | + # { "badProperty": "this property should not exist" } + | #/000/tests/000/data | false | applicator vocabulary still works | + # { "numberProperty": 20 } + | #/000/tests/001/data | true | no validation: valid number | + # { "numberProperty": 1 } + | #/000/tests/002/data | true | no validation: invalid number, but it still validates | + +Scenario Outline: ignore unrecognized optional vocabulary +/* Schema: +{ + "$schema": "http://localhost:1234/draft2020-12/metaschema-optional-vocabulary.json", + "type": "number" + } +*/ + Given the input JSON file "vocabulary.json" + And the schema at "#/1/schema" + And the input data at "" + And I generate a type for the schema + And I construct an instance of the schema type from the data + When I validate the instance + Then the result will be + + Examples: + | inputDataReference | valid | description | + # foobar + | #/001/tests/000/data | false | string value | + # 20 + | #/001/tests/001/data | true | number value | diff --git a/Solutions/Corvus.JsonSchema.SpecGenerator/JsonSchemaOrgTestSuiteSelector.jsonc b/Solutions/Corvus.JsonSchema.SpecGenerator/JsonSchemaOrgTestSuiteSelector.jsonc index 6b07e3ef4..9f7ea2f57 100644 --- a/Solutions/Corvus.JsonSchema.SpecGenerator/JsonSchemaOrgTestSuiteSelector.jsonc +++ b/Solutions/Corvus.JsonSchema.SpecGenerator/JsonSchemaOrgTestSuiteSelector.jsonc @@ -184,7 +184,7 @@ "outputFolder": "Draft2020212", "excludeFromThisDirectory": [ // We don't support custom metaschema (yet!) - "vocabulary\\.json" + ////"vocabulary\\.json" ], "subdirectories": { "optional": {