Files
jspg/tests/fixtures/emptyString.json

133 lines
4.0 KiB
JSON

[
{
"description": "empty string is valid for all types (except const)",
"database": {
"schemas": [
{
"properties": {
"obj": {
"type": "object"
},
"arr": {
"type": "array"
},
"str": {
"type": "string"
},
"int": {
"type": "integer"
},
"num": {
"type": "number"
},
"bool": {
"type": "boolean"
},
"nul": {
"type": "null"
},
"fmt": {
"type": "string",
"format": "uuid"
},
"con": {
"const": "value"
},
"con_empty": {
"const": ""
}
},
"$id": "emptyString_0_0"
}
]
},
"tests": [
{
"description": "empty string valid for object",
"data": {
"obj": ""
},
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string valid for array",
"data": {
"arr": ""
},
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string valid for string",
"data": {
"str": ""
},
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string valid for integer",
"data": {
"int": ""
},
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string valid for number",
"data": {
"num": ""
},
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string valid for boolean",
"data": {
"bool": ""
},
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string valid for null",
"data": {
"nul": ""
},
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string valid for format",
"data": {
"fmt": ""
},
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string INVALID for const (unless const is empty string)",
"data": {
"con": ""
},
"valid": false,
"expect_errors": [
{
"code": "CONST_VIOLATED",
"path": "/con"
}
],
"schema_id": "emptyString_0_0"
},
{
"description": "empty string VALID for const if const IS empty string",
"data": {
"con_empty": ""
},
"valid": true,
"schema_id": "emptyString_0_0"
}
]
}
]