punc request and response moved to punc schemas
This commit is contained in:
168
src/schemas.rs
168
src/schemas.rs
@ -13,14 +13,15 @@ pub fn simple_schemas() -> JsonB {
|
||||
let puncs = json!([{
|
||||
"name": "simple",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "simple.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"age": { "type": "integer", "minimum": 0 }
|
||||
},
|
||||
"required": ["name", "age"]
|
||||
}
|
||||
}]
|
||||
}]);
|
||||
|
||||
cache_json_schemas(jsonb(enums), jsonb(types), jsonb(puncs))
|
||||
@ -32,10 +33,10 @@ pub fn invalid_schemas() -> JsonB {
|
||||
let puncs = json!([{
|
||||
"name": "invalid_punc",
|
||||
"public": false,
|
||||
"request": {
|
||||
"$id": "urn:invalid_schema",
|
||||
"schemas": [{
|
||||
"$id": "invalid_punc.request",
|
||||
"type": ["invalid_type_value"]
|
||||
}
|
||||
}]
|
||||
}]);
|
||||
|
||||
cache_json_schemas(jsonb(enums), jsonb(types), jsonb(puncs))
|
||||
@ -47,7 +48,8 @@ pub fn errors_schemas() -> JsonB {
|
||||
let puncs = json!([{
|
||||
"name": "detailed_errors_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "detailed_errors_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address": {
|
||||
@ -60,7 +62,7 @@ pub fn errors_schemas() -> JsonB {
|
||||
}
|
||||
},
|
||||
"required": ["address"]
|
||||
}
|
||||
}]
|
||||
}]);
|
||||
|
||||
cache_json_schemas(jsonb(enums), jsonb(types), jsonb(puncs))
|
||||
@ -72,7 +74,8 @@ pub fn oneof_schemas() -> JsonB {
|
||||
let puncs = json!([{
|
||||
"name": "oneof_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "oneof_test.request",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
@ -89,7 +92,7 @@ pub fn oneof_schemas() -> JsonB {
|
||||
"required": ["number_prop"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}]
|
||||
}]);
|
||||
|
||||
cache_json_schemas(jsonb(enums), jsonb(types), jsonb(puncs))
|
||||
@ -102,19 +105,21 @@ pub fn root_types_schemas() -> JsonB {
|
||||
{
|
||||
"name": "object_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "object_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"age": { "type": "integer", "minimum": 0 }
|
||||
},
|
||||
"required": ["name", "age"]
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"name": "array_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "array_test.request",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
@ -122,7 +127,7 @@ pub fn root_types_schemas() -> JsonB {
|
||||
"id": { "type": "string", "format": "uuid" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
]);
|
||||
|
||||
@ -136,27 +141,30 @@ pub fn strict_schemas() -> JsonB {
|
||||
{
|
||||
"name": "basic_strict_test",
|
||||
"public": true,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "basic_strict_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": { "type": "string" }
|
||||
}
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"name": "non_strict_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "non_strict_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": { "type": "string" }
|
||||
}
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"name": "nested_strict_test",
|
||||
"public": true,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "nested_strict_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"user": {
|
||||
@ -175,34 +183,37 @@ pub fn strict_schemas() -> JsonB {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"name": "already_unevaluated_test",
|
||||
"public": true,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "already_unevaluated_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": { "type": "string" }
|
||||
},
|
||||
"unevaluatedProperties": true
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"name": "already_additional_test",
|
||||
"public": true,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "already_additional_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": { "type": "string" }
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"name": "conditional_strict_test",
|
||||
"public": true,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "conditional_strict_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"creating": { "type": "boolean" }
|
||||
@ -218,7 +229,7 @@ pub fn strict_schemas() -> JsonB {
|
||||
},
|
||||
"required": ["name"]
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
]);
|
||||
|
||||
@ -231,14 +242,15 @@ pub fn required_schemas() -> JsonB {
|
||||
let puncs = json!([{
|
||||
"name": "basic_validation_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "basic_validation_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"age": { "type": "integer", "minimum": 0 }
|
||||
},
|
||||
"required": ["name", "age"]
|
||||
}
|
||||
}]
|
||||
}]);
|
||||
|
||||
cache_json_schemas(jsonb(enums), jsonb(types), jsonb(puncs))
|
||||
@ -250,7 +262,8 @@ pub fn dependencies_schemas() -> JsonB {
|
||||
let puncs = json!([{
|
||||
"name": "dependency_split_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "dependency_split_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"creating": { "type": "boolean" },
|
||||
@ -261,7 +274,7 @@ pub fn dependencies_schemas() -> JsonB {
|
||||
"dependencies": {
|
||||
"creating": ["name", "kind"]
|
||||
}
|
||||
}
|
||||
}]
|
||||
}]);
|
||||
|
||||
cache_json_schemas(jsonb(enums), jsonb(types), jsonb(puncs))
|
||||
@ -273,7 +286,8 @@ pub fn nested_req_deps_schemas() -> JsonB {
|
||||
let puncs = json!([{
|
||||
"name": "nested_dep_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "nested_dep_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"items": {
|
||||
@ -294,7 +308,7 @@ pub fn nested_req_deps_schemas() -> JsonB {
|
||||
}
|
||||
},
|
||||
"required": ["items"]
|
||||
}
|
||||
}]
|
||||
}]);
|
||||
|
||||
cache_json_schemas(jsonb(enums), jsonb(types), jsonb(puncs))
|
||||
@ -307,19 +321,21 @@ pub fn additional_properties_schemas() -> JsonB {
|
||||
{
|
||||
"name": "additional_props_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "additional_props_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"age": { "type": "number" }
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"name": "nested_additional_props_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "nested_additional_props_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"user": {
|
||||
@ -330,7 +346,7 @@ pub fn additional_properties_schemas() -> JsonB {
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
]);
|
||||
|
||||
@ -344,7 +360,8 @@ pub fn unevaluated_properties_schemas() -> JsonB {
|
||||
{
|
||||
"name": "simple_unevaluated_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "simple_unevaluated_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
@ -354,12 +371,13 @@ pub fn unevaluated_properties_schemas() -> JsonB {
|
||||
"^attr_": { "type": "string" }
|
||||
},
|
||||
"unevaluatedProperties": false
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"name": "conditional_unevaluated_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "conditional_unevaluated_test.request",
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
@ -377,7 +395,7 @@ pub fn unevaluated_properties_schemas() -> JsonB {
|
||||
"age": { "type": "number" }
|
||||
},
|
||||
"unevaluatedProperties": false
|
||||
}
|
||||
}]
|
||||
}
|
||||
]);
|
||||
|
||||
@ -390,14 +408,15 @@ pub fn format_schemas() -> JsonB {
|
||||
let puncs = json!([{
|
||||
"name": "format_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "format_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"uuid": { "type": "string", "format": "uuid" },
|
||||
"date_time": { "type": "string", "format": "date-time" },
|
||||
"email": { "type": "string", "format": "email" }
|
||||
}
|
||||
}
|
||||
}]
|
||||
}]);
|
||||
|
||||
cache_json_schemas(jsonb(enums), jsonb(types), jsonb(puncs))
|
||||
@ -602,16 +621,18 @@ pub fn punc_with_refs_schemas() -> JsonB {
|
||||
{
|
||||
"name": "public_ref_test",
|
||||
"public": true,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "public_ref_test.request",
|
||||
"$ref": "person"
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"name": "private_ref_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "private_ref_test.request",
|
||||
"$ref": "person"
|
||||
}
|
||||
}]
|
||||
}
|
||||
]);
|
||||
|
||||
@ -636,13 +657,14 @@ pub fn enum_schemas() -> JsonB {
|
||||
let puncs = json!([{
|
||||
"name": "enum_ref_test",
|
||||
"public": false,
|
||||
"request": {
|
||||
"schemas": [{
|
||||
"$id": "enum_ref_test.request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"priority": { "$ref": "task_priority" }
|
||||
},
|
||||
"required": ["priority"]
|
||||
}
|
||||
}]
|
||||
}]);
|
||||
|
||||
cache_json_schemas(jsonb(enums), jsonb(types), jsonb(puncs))
|
||||
@ -669,34 +691,40 @@ pub fn punc_local_refs_schemas() -> JsonB {
|
||||
{
|
||||
"name": "punc_with_local_ref_test",
|
||||
"public": false,
|
||||
"schemas": [{
|
||||
"$id": "local_address",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"street": { "type": "string" },
|
||||
"city": { "type": "string" }
|
||||
"schemas": [
|
||||
{
|
||||
"$id": "local_address",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"street": { "type": "string" },
|
||||
"city": { "type": "string" }
|
||||
},
|
||||
"required": ["street", "city"]
|
||||
},
|
||||
"required": ["street", "city"]
|
||||
}],
|
||||
"request": {
|
||||
"$ref": "local_address"
|
||||
}
|
||||
{
|
||||
"$id": "punc_with_local_ref_test.request",
|
||||
"$ref": "local_address"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "punc_with_local_ref_to_global_test",
|
||||
"public": false,
|
||||
"schemas": [{
|
||||
"$id": "local_user_with_thing",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"user_name": { "type": "string" },
|
||||
"thing": { "$ref": "global_thing" }
|
||||
"schemas": [
|
||||
{
|
||||
"$id": "local_user_with_thing",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"user_name": { "type": "string" },
|
||||
"thing": { "$ref": "global_thing" }
|
||||
},
|
||||
"required": ["user_name", "thing"]
|
||||
},
|
||||
"required": ["user_name", "thing"]
|
||||
}],
|
||||
"request": {
|
||||
"$ref": "local_user_with_thing"
|
||||
}
|
||||
{
|
||||
"$id": "punc_with_local_ref_to_global_test.request",
|
||||
"$ref": "local_user_with_thing"
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
|
||||
@ -732,4 +760,4 @@ pub fn title_override_schemas() -> JsonB {
|
||||
let puncs = json!([]);
|
||||
|
||||
cache_json_schemas(jsonb(enums), jsonb(types), jsonb(puncs))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user