Skip to content

Commit

Permalink
Update OpenAPI 3.0 schema URI
Browse files Browse the repository at this point in the history
  • Loading branch information
GREsau committed May 13, 2024
1 parent dec3c67 commit 4dde683
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion schemars/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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![
Expand Down
78 changes: 39 additions & 39 deletions schemars/tests/expected/from_value_openapi3.json
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -35,6 +37,12 @@
"type": "array",
"items": {}
},
"my_map": {
"type": "object",
"additionalProperties": {
"type": "number"
}
},
"my_tuple": {
"type": "array",
"items": [
Expand All @@ -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
}
}
}
38 changes: 19 additions & 19 deletions schemars/tests/expected/schema_settings-openapi3.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand All @@ -46,13 +46,13 @@
},
{
"type": "object",
"required": [
"ValueNewType"
],
"additionalProperties": false,
"properties": {
"ValueNewType": {}
},
"additionalProperties": false
"required": [
"ValueNewType"
]
}
]
}
Expand Down

0 comments on commit 4dde683

Please sign in to comment.