Add strongly-typed validation fields

This commit is contained in:
Graham Esau 2019-09-12 22:49:38 +01:00
parent 5de6bcfdef
commit 88a8e0a706
9 changed files with 597 additions and 99 deletions

View file

@ -26,14 +26,14 @@
},
"Ref": {
"type": "object",
"required": [
"$ref"
],
"properties": {
"$ref": {
"type": "string"
}
},
"required": [
"$ref"
]
}
},
"Schema": {
"anyOf": [
@ -59,6 +59,34 @@
"type": "string",
"nullable": true
},
"additionalItems": {
"anyOf": [
{
"type": "boolean"
},
{
"$ref": "#/components/schemas/Ref"
},
{
"$ref": "#/components/schemas/SchemaObject"
}
],
"nullable": true
},
"additionalProperties": {
"anyOf": [
{
"type": "boolean"
},
{
"$ref": "#/components/schemas/Ref"
},
{
"$ref": "#/components/schemas/SchemaObject"
}
],
"nullable": true
},
"allOf": {
"type": "array",
"items": {
@ -73,6 +101,20 @@
},
"nullable": true
},
"contains": {
"anyOf": [
{
"type": "boolean"
},
{
"$ref": "#/components/schemas/Ref"
},
{
"$ref": "#/components/schemas/SchemaObject"
}
],
"nullable": true
},
"definitions": {
"type": "object",
"additionalProperties": {
@ -83,15 +125,53 @@
"type": "string",
"nullable": true
},
"else": {
"anyOf": [
{
"type": "boolean"
},
{
"$ref": "#/components/schemas/Ref"
},
{
"$ref": "#/components/schemas/SchemaObject"
}
],
"nullable": true
},
"enum": {
"type": "array",
"items": {},
"nullable": true
},
"exclusiveMaximum": {
"type": "number",
"format": "double",
"nullable": true
},
"exclusiveMinimum": {
"type": "number",
"format": "double",
"nullable": true
},
"format": {
"type": "string",
"nullable": true
},
"if": {
"anyOf": [
{
"type": "boolean"
},
{
"$ref": "#/components/schemas/Ref"
},
{
"$ref": "#/components/schemas/SchemaObject"
}
],
"nullable": true
},
"items": {
"anyOf": [
{
@ -106,6 +186,51 @@
],
"nullable": true
},
"maxItems": {
"type": "integer",
"format": "uint32",
"nullable": true
},
"maxLength": {
"type": "integer",
"format": "uint32",
"nullable": true
},
"maxProperties": {
"type": "integer",
"format": "uint32",
"nullable": true
},
"maximum": {
"type": "number",
"format": "double",
"nullable": true
},
"minItems": {
"type": "integer",
"format": "uint32",
"nullable": true
},
"minLength": {
"type": "integer",
"format": "uint32",
"nullable": true
},
"minProperties": {
"type": "integer",
"format": "uint32",
"nullable": true
},
"minimum": {
"type": "number",
"format": "double",
"nullable": true
},
"multipleOf": {
"type": "number",
"format": "double",
"nullable": true
},
"not": {
"anyOf": [
{
@ -127,18 +252,56 @@
},
"nullable": true
},
"pattern": {
"type": "string",
"nullable": true
},
"patternProperties": {
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/Schema"
}
},
"properties": {
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/Schema"
}
},
"propertyNames": {
"anyOf": [
{
"type": "boolean"
},
{
"$ref": "#/components/schemas/Ref"
},
{
"$ref": "#/components/schemas/SchemaObject"
}
],
"nullable": true
},
"required": {
"type": "array",
"items": {
"type": "string"
}
},
"then": {
"anyOf": [
{
"type": "boolean"
},
{
"$ref": "#/components/schemas/Ref"
},
{
"$ref": "#/components/schemas/SchemaObject"
}
],
"nullable": true
},
"title": {
"type": "string",
"nullable": true
@ -156,6 +319,10 @@
}
],
"nullable": true
},
"uniqueItems": {
"type": "boolean",
"nullable": true
}
},
"additionalProperties": true

View file

@ -26,14 +26,14 @@
},
"Ref": {
"type": "object",
"required": [
"$ref"
],
"properties": {
"$ref": {
"type": "string"
}
},
"required": [
"$ref"
]
}
},
"Schema": {
"anyOf": [
@ -71,6 +71,26 @@
}
]
},
"additionalItems": {
"anyOf": [
{
"$ref": "#/definitions/Schema"
},
{
"type": "null"
}
]
},
"additionalProperties": {
"anyOf": [
{
"$ref": "#/definitions/Schema"
},
{
"type": "null"
}
]
},
"allOf": {
"anyOf": [
{
@ -97,6 +117,16 @@
}
]
},
"contains": {
"anyOf": [
{
"$ref": "#/definitions/Schema"
},
{
"type": "null"
}
]
},
"definitions": {
"type": "object",
"additionalProperties": {
@ -113,6 +143,16 @@
}
]
},
"else": {
"anyOf": [
{
"$ref": "#/definitions/Schema"
},
{
"type": "null"
}
]
},
"enum": {
"anyOf": [
{
@ -124,6 +164,28 @@
}
]
},
"exclusiveMaximum": {
"anyOf": [
{
"type": "number",
"format": "double"
},
{
"type": "null"
}
]
},
"exclusiveMinimum": {
"anyOf": [
{
"type": "number",
"format": "double"
},
{
"type": "null"
}
]
},
"format": {
"anyOf": [
{
@ -134,6 +196,16 @@
}
]
},
"if": {
"anyOf": [
{
"$ref": "#/definitions/Schema"
},
{
"type": "null"
}
]
},
"items": {
"anyOf": [
{
@ -144,6 +216,105 @@
}
]
},
"maxItems": {
"anyOf": [
{
"type": "integer",
"format": "uint32"
},
{
"type": "null"
}
]
},
"maxLength": {
"anyOf": [
{
"type": "integer",
"format": "uint32"
},
{
"type": "null"
}
]
},
"maxProperties": {
"anyOf": [
{
"type": "integer",
"format": "uint32"
},
{
"type": "null"
}
]
},
"maximum": {
"anyOf": [
{
"type": "number",
"format": "double"
},
{
"type": "null"
}
]
},
"minItems": {
"anyOf": [
{
"type": "integer",
"format": "uint32"
},
{
"type": "null"
}
]
},
"minLength": {
"anyOf": [
{
"type": "integer",
"format": "uint32"
},
{
"type": "null"
}
]
},
"minProperties": {
"anyOf": [
{
"type": "integer",
"format": "uint32"
},
{
"type": "null"
}
]
},
"minimum": {
"anyOf": [
{
"type": "number",
"format": "double"
},
{
"type": "null"
}
]
},
"multipleOf": {
"anyOf": [
{
"type": "number",
"format": "double"
},
{
"type": "null"
}
]
},
"not": {
"anyOf": [
{
@ -167,18 +338,54 @@
}
]
},
"pattern": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"patternProperties": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Schema"
}
},
"properties": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Schema"
}
},
"propertyNames": {
"anyOf": [
{
"$ref": "#/definitions/Schema"
},
{
"type": "null"
}
]
},
"required": {
"type": "array",
"items": {
"type": "string"
}
},
"then": {
"anyOf": [
{
"$ref": "#/definitions/Schema"
},
{
"type": "null"
}
]
},
"title": {
"anyOf": [
{
@ -198,6 +405,16 @@
"type": "null"
}
]
},
"uniqueItems": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
}
},
"additionalProperties": true