Reorganise tests
This commit is contained in:
parent
d14db450cf
commit
67d44533d6
10 changed files with 147 additions and 112 deletions
30
schemars/tests/expected/naming-custom.json
Normal file
30
schemars/tests/expected/naming-custom.json
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "a-new-name-Array_Of_String-Integer-Integer",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"inner": {
|
||||
"$ref": "#/definitions/MySimpleStruct"
|
||||
},
|
||||
"t": {
|
||||
"type": "integer"
|
||||
},
|
||||
"u": {
|
||||
"type": "null"
|
||||
},
|
||||
"v": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"w": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"another-new-name": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
30
schemars/tests/expected/naming-default.json
Normal file
30
schemars/tests/expected/naming-default.json
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "MyStruct_For_Integer_And_Null_And_Boolean_And_Array_Of_String",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"inner": {
|
||||
"$ref": "#/definitions/MySimpleStruct"
|
||||
},
|
||||
"t": {
|
||||
"type": "integer"
|
||||
},
|
||||
"u": {
|
||||
"type": "null"
|
||||
},
|
||||
"v": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"w": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"MySimpleStruct": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
183
schemars/tests/expected/schema-openapi3.json
Normal file
183
schemars/tests/expected/schema-openapi3.json
Normal file
|
@ -0,0 +1,183 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Schema",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/SchemaRef"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/SchemaObject"
|
||||
}
|
||||
],
|
||||
"definitions": {
|
||||
"InstanceType": {
|
||||
"enum": [
|
||||
"null",
|
||||
"boolean",
|
||||
"object",
|
||||
"array",
|
||||
"number",
|
||||
"string",
|
||||
"integer"
|
||||
]
|
||||
},
|
||||
"Schema": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/SchemaRef"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/SchemaObject"
|
||||
}
|
||||
]
|
||||
},
|
||||
"SchemaObject": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$id": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"$schema": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"allOf": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Schema"
|
||||
},
|
||||
"nullable": true
|
||||
},
|
||||
"anyOf": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Schema"
|
||||
},
|
||||
"nullable": true
|
||||
},
|
||||
"definitions": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/components/schemas/Schema"
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"enum": {
|
||||
"type": "array",
|
||||
"items": {},
|
||||
"nullable": true
|
||||
},
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Schema"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Schema"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
},
|
||||
"not": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/SchemaRef"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/SchemaObject"
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
},
|
||||
"oneOf": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Schema"
|
||||
},
|
||||
"nullable": true
|
||||
},
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/components/schemas/Schema"
|
||||
}
|
||||
},
|
||||
"required": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"title": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"type": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/InstanceType"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/InstanceType"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
},
|
||||
"SchemaRef": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$ref": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SingleOrVec_For_InstanceType": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/InstanceType"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/InstanceType"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"SingleOrVec_For_Schema": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Schema"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Schema"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
219
schemars/tests/expected/schema.json
Normal file
219
schemars/tests/expected/schema.json
Normal file
|
@ -0,0 +1,219 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Schema",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/SchemaRef"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/SchemaObject"
|
||||
}
|
||||
],
|
||||
"definitions": {
|
||||
"InstanceType": {
|
||||
"enum": [
|
||||
"null",
|
||||
"boolean",
|
||||
"object",
|
||||
"array",
|
||||
"number",
|
||||
"string",
|
||||
"integer"
|
||||
]
|
||||
},
|
||||
"Schema": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/SchemaRef"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/SchemaObject"
|
||||
}
|
||||
]
|
||||
},
|
||||
"SchemaObject": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$id": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"$schema": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"allOf": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Schema"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"anyOf": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Schema"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"definitions": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/Schema"
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"enum": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": true
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SingleOrVec_For_Schema"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"not": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Schema"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"oneOf": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Schema"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/Schema"
|
||||
}
|
||||
},
|
||||
"required": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"title": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SingleOrVec_For_InstanceType"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
},
|
||||
"SchemaRef": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$ref": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SingleOrVec_For_InstanceType": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/InstanceType"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/InstanceType"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"SingleOrVec_For_Schema": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Schema"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Schema"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue