diff --git a/schemars/src/gen.rs b/schemars/src/gen.rs index d19f80b9..8336eccc 100644 --- a/schemars/src/gen.rs +++ b/schemars/src/gen.rs @@ -88,7 +88,7 @@ impl SchemaSettings { option_add_null_type: false, definitions_path: "#/components/schemas/".to_owned(), meta_schema: Some( - "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema" + "https://spec.openapis.org/oas/3.0/schema/2021-09-28#/definitions/Schema" .to_owned(), ), visitors: vec![ diff --git a/schemars/tests/expected/from_value_openapi3.json b/schemars/tests/expected/from_value_openapi3.json index 132a59a2..858d2862 100644 --- a/schemars/tests/expected/from_value_openapi3.json +++ b/schemars/tests/expected/from_value_openapi3.json @@ -1,32 +1,34 @@ { - "$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema", + "$schema": "https://spec.openapis.org/oas/3.0/schema/2021-09-28#/definitions/Schema", "title": "MyStruct", "type": "object", - "properties": { - "myInt": { - "type": "integer" + "example": { + "myBool": true, + "myInnerStruct": { + "my_empty_map": {}, + "my_empty_vec": [], + "my_map": { + "": 0.0 + }, + "my_tuple": [ + "💩", + 42 + ], + "my_vec": [ + "hello", + "world" + ] }, + "myInt": 123, + "myNullableEnum": null + }, + "properties": { "myBool": { "type": "boolean" }, - "myNullableEnum": { - "nullable": true - }, "myInnerStruct": { "type": "object", "properties": { - "my_map": { - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "my_vec": { - "type": "array", - "items": { - "type": "string" - } - }, "my_empty_map": { "type": "object", "additionalProperties": true @@ -35,6 +37,12 @@ "type": "array", "items": {} }, + "my_map": { + "type": "object", + "additionalProperties": { + "type": "number" + } + }, "my_tuple": { "type": "array", "items": [ @@ -49,28 +57,20 @@ ], "maxItems": 2, "minItems": 2 + }, + "my_vec": { + "type": "array", + "items": { + "type": "string" + } } } - } - }, - "example": { - "myBool": true, - "myInnerStruct": { - "my_empty_map": {}, - "my_empty_vec": [], - "my_map": { - "": 0.0 - }, - "my_tuple": [ - "💩", - 42 - ], - "my_vec": [ - "hello", - "world" - ] }, - "myInt": 123, - "myNullableEnum": null + "myInt": { + "type": "integer" + }, + "myNullableEnum": { + "nullable": true + } } } \ No newline at end of file diff --git a/schemars/tests/expected/schema_settings-openapi3.json b/schemars/tests/expected/schema_settings-openapi3.json index 17fe8051..15b752d5 100644 --- a/schemars/tests/expected/schema_settings-openapi3.json +++ b/schemars/tests/expected/schema_settings-openapi3.json @@ -1,32 +1,32 @@ { - "$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema", + "$schema": "https://spec.openapis.org/oas/3.0/schema/2021-09-28#/definitions/Schema", "title": "Outer", "type": "object", - "required": [ - "int", - "value", - "values" - ], "properties": { + "inner": { + "allOf": [ + { + "$ref": "#/components/schemas/Inner" + } + ], + "nullable": true + }, "int": { "type": "integer", "format": "int32", "example": 8 }, + "value": {}, "values": { "type": "object", "additionalProperties": true - }, - "value": {}, - "inner": { - "allOf": [ - { - "$ref": "#/components/schemas/Inner" - } - ], - "nullable": true } }, + "required": [ + "int", + "value", + "values" + ], "definitions": { "Inner": { "oneOf": [ @@ -46,13 +46,13 @@ }, { "type": "object", - "required": [ - "ValueNewType" - ], + "additionalProperties": false, "properties": { "ValueNewType": {} }, - "additionalProperties": false + "required": [ + "ValueNewType" + ] } ] }