Respect with
attributes on enum variants
This commit is contained in:
parent
1e17c46803
commit
08886799bb
8 changed files with 161 additions and 25 deletions
|
@ -18,9 +18,14 @@ pub enum External {
|
|||
StringMap(Map<String, String>),
|
||||
UnitStructNewType(UnitStruct),
|
||||
StructNewType(Struct),
|
||||
Struct { foo: i32, bar: bool },
|
||||
Struct {
|
||||
foo: i32,
|
||||
bar: bool,
|
||||
},
|
||||
UnitTwo,
|
||||
Tuple(i32, bool),
|
||||
#[schemars(with = "i32")]
|
||||
WithInt,
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -35,8 +40,13 @@ pub enum Internal {
|
|||
StringMap(Map<String, String>),
|
||||
UnitStructNewType(UnitStruct),
|
||||
StructNewType(Struct),
|
||||
Struct { foo: i32, bar: bool },
|
||||
Struct {
|
||||
foo: i32,
|
||||
bar: bool,
|
||||
},
|
||||
UnitTwo,
|
||||
#[schemars(with = "i32")]
|
||||
WithInt,
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -51,8 +61,13 @@ pub enum Untagged {
|
|||
StringMap(Map<String, String>),
|
||||
UnitStructNewType(UnitStruct),
|
||||
StructNewType(Struct),
|
||||
Struct { foo: i32, bar: bool },
|
||||
Struct {
|
||||
foo: i32,
|
||||
bar: bool,
|
||||
},
|
||||
Tuple(i32, bool),
|
||||
#[schemars(with = "i32")]
|
||||
WithInt,
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -67,8 +82,14 @@ pub enum Adjacent {
|
|||
StringMap(Map<String, String>),
|
||||
UnitStructNewType(UnitStruct),
|
||||
StructNewType(Struct),
|
||||
Struct { foo: i32, bar: bool },
|
||||
Struct {
|
||||
foo: i32,
|
||||
bar: bool,
|
||||
},
|
||||
Tuple(i32, bool),
|
||||
UnitTwo,
|
||||
#[schemars(with = "i32")]
|
||||
WithInt,
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -89,6 +89,18 @@
|
|||
"minItems": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"withInt"
|
||||
],
|
||||
"properties": {
|
||||
"withInt": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"definitions": {
|
||||
|
|
|
@ -106,6 +106,24 @@
|
|||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": [
|
||||
"object",
|
||||
"integer"
|
||||
],
|
||||
"format": "int32",
|
||||
"required": [
|
||||
"typeProperty"
|
||||
],
|
||||
"properties": {
|
||||
"typeProperty": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"WithInt"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -46,6 +46,10 @@
|
|||
],
|
||||
"maxItems": 2,
|
||||
"minItems": 2
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
],
|
||||
"definitions": {
|
||||
|
|
|
@ -145,6 +145,39 @@
|
|||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"t"
|
||||
],
|
||||
"properties": {
|
||||
"t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"UnitTwo"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"c",
|
||||
"t"
|
||||
],
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"WithInt"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue