@@ -26,6 +26,44 @@ pub mod error {
26
26
}
27
27
}
28
28
}
29
+ #[ doc = "OuterThing" ]
30
+ #[ doc = r"" ]
31
+ #[ doc = r" <details><summary>JSON schema</summary>" ]
32
+ #[ doc = r"" ]
33
+ #[ doc = r" ```json" ]
34
+ #[ doc = "{" ]
35
+ #[ doc = " \" type\" : \" object\" ," ]
36
+ #[ doc = " \" properties\" : {" ]
37
+ #[ doc = " \" thing\" : {" ]
38
+ #[ doc = " \" title\" : \" ThingWithDefaults\" ," ]
39
+ #[ doc = " \" default\" : {" ]
40
+ #[ doc = " \" type\" : \" bee\" " ]
41
+ #[ doc = " }," ]
42
+ #[ doc = " \" type\" : \" object\" ," ]
43
+ #[ doc = " \" properties\" : {" ]
44
+ #[ doc = " \" a\" : {" ]
45
+ #[ doc = " \" type\" : \" string\" " ]
46
+ #[ doc = " }," ]
47
+ #[ doc = " \" type\" : {" ]
48
+ #[ doc = " \" type\" : \" string\" " ]
49
+ #[ doc = " }" ]
50
+ #[ doc = " }," ]
51
+ #[ doc = " \" additionalProperties\" : false" ]
52
+ #[ doc = " }" ]
53
+ #[ doc = " }" ]
54
+ #[ doc = "}" ]
55
+ #[ doc = r" ```" ]
56
+ #[ doc = r" </details>" ]
57
+ #[ derive( Clone , Debug , Deserialize , Serialize ) ]
58
+ pub struct OuterThing {
59
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
60
+ pub thing : Option < ThingWithDefaults > ,
61
+ }
62
+ impl From < & OuterThing > for OuterThing {
63
+ fn from ( value : & OuterThing ) -> Self {
64
+ value. clone ( )
65
+ }
66
+ }
29
67
#[ doc = "TestBed" ]
30
68
#[ doc = r"" ]
31
69
#[ doc = r" <details><summary>JSON schema</summary>" ]
@@ -72,6 +110,50 @@ impl From<&TestBed> for TestBed {
72
110
value. clone ( )
73
111
}
74
112
}
113
+ #[ doc = "ThingWithDefaults" ]
114
+ #[ doc = r"" ]
115
+ #[ doc = r" <details><summary>JSON schema</summary>" ]
116
+ #[ doc = r"" ]
117
+ #[ doc = r" ```json" ]
118
+ #[ doc = "{" ]
119
+ #[ doc = " \" title\" : \" ThingWithDefaults\" ," ]
120
+ #[ doc = " \" default\" : {" ]
121
+ #[ doc = " \" type\" : \" bee\" " ]
122
+ #[ doc = " }," ]
123
+ #[ doc = " \" type\" : \" object\" ," ]
124
+ #[ doc = " \" properties\" : {" ]
125
+ #[ doc = " \" a\" : {" ]
126
+ #[ doc = " \" type\" : \" string\" " ]
127
+ #[ doc = " }," ]
128
+ #[ doc = " \" type\" : {" ]
129
+ #[ doc = " \" type\" : \" string\" " ]
130
+ #[ doc = " }" ]
131
+ #[ doc = " }," ]
132
+ #[ doc = " \" additionalProperties\" : false" ]
133
+ #[ doc = "}" ]
134
+ #[ doc = r" ```" ]
135
+ #[ doc = r" </details>" ]
136
+ #[ derive( Clone , Debug , Deserialize , Serialize ) ]
137
+ #[ serde( deny_unknown_fields) ]
138
+ pub struct ThingWithDefaults {
139
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
140
+ pub a : Option < String > ,
141
+ #[ serde( rename = "type" , default , skip_serializing_if = "Option::is_none" ) ]
142
+ pub type_ : Option < String > ,
143
+ }
144
+ impl From < & ThingWithDefaults > for ThingWithDefaults {
145
+ fn from ( value : & ThingWithDefaults ) -> Self {
146
+ value. clone ( )
147
+ }
148
+ }
149
+ impl Default for ThingWithDefaults {
150
+ fn default ( ) -> Self {
151
+ ThingWithDefaults {
152
+ a : Default :: default ( ) ,
153
+ type_ : Some ( "bee" . to_string ( ) ) ,
154
+ }
155
+ }
156
+ }
75
157
#[ doc = r" Generation of default values for serde." ]
76
158
pub mod defaults {
77
159
pub ( super ) fn test_bed_any ( ) -> Vec < serde_json:: Value > {
0 commit comments