diff --git a/tests/draft2019-09/default.json b/tests/draft2019-09/default.json index 95eba5a7..f2cdf50a 100644 --- a/tests/draft2019-09/default.json +++ b/tests/draft2019-09/default.json @@ -78,5 +78,31 @@ "valid": true } ] + }, + { + "description": "the default keyword does not interact with required", + "schema": { + "$schema": "https://json-schema.org/draft/2019-09/schema", + "type": "object", + "properties": { + "alpha": { + "type": "number", + "default": 5 + } + }, + "required": ["alpha"] + }, + "tests": [ + { + "description": "An explicit property passes required", + "data": { "alpha": 1 }, + "valid": true + }, + { + "description": "missing properties are not filled in with the default by required", + "data": {}, + "valid": false + } + ] } ] diff --git a/tests/draft2020-12/default.json b/tests/draft2020-12/default.json index ceb3ae27..2c07f8e8 100644 --- a/tests/draft2020-12/default.json +++ b/tests/draft2020-12/default.json @@ -78,5 +78,31 @@ "valid": true } ] + }, + { + "description": "the default keyword does not interact with required", + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "alpha": { + "type": "number", + "default": 5 + } + }, + "required": ["alpha"] + }, + "tests": [ + { + "description": "An explicit property passes required", + "data": { "alpha": 1 }, + "valid": true + }, + { + "description": "missing properties are not filled in with the default by required", + "data": {}, + "valid": false + } + ] } ] diff --git a/tests/draft4/default.json b/tests/draft4/default.json index 289a9b66..1d6ab177 100644 --- a/tests/draft4/default.json +++ b/tests/draft4/default.json @@ -75,5 +75,30 @@ "valid": true } ] + }, + { + "description": "the default keyword does not interact with required", + "schema": { + "type": "object", + "properties": { + "alpha": { + "type": "number", + "default": 5 + } + }, + "required": ["alpha"] + }, + "tests": [ + { + "description": "An explicit property passes required", + "data": { "alpha": 1 }, + "valid": true + }, + { + "description": "missing properties are not filled in with the default by required", + "data": {}, + "valid": false + } + ] } ] diff --git a/tests/draft6/default.json b/tests/draft6/default.json index 289a9b66..1d6ab177 100644 --- a/tests/draft6/default.json +++ b/tests/draft6/default.json @@ -75,5 +75,30 @@ "valid": true } ] + }, + { + "description": "the default keyword does not interact with required", + "schema": { + "type": "object", + "properties": { + "alpha": { + "type": "number", + "default": 5 + } + }, + "required": ["alpha"] + }, + "tests": [ + { + "description": "An explicit property passes required", + "data": { "alpha": 1 }, + "valid": true + }, + { + "description": "missing properties are not filled in with the default by required", + "data": {}, + "valid": false + } + ] } ] diff --git a/tests/draft7/default.json b/tests/draft7/default.json index 289a9b66..1d6ab177 100644 --- a/tests/draft7/default.json +++ b/tests/draft7/default.json @@ -75,5 +75,30 @@ "valid": true } ] + }, + { + "description": "the default keyword does not interact with required", + "schema": { + "type": "object", + "properties": { + "alpha": { + "type": "number", + "default": 5 + } + }, + "required": ["alpha"] + }, + "tests": [ + { + "description": "An explicit property passes required", + "data": { "alpha": 1 }, + "valid": true + }, + { + "description": "missing properties are not filled in with the default by required", + "data": {}, + "valid": false + } + ] } ]