@@ -53,6 +53,44 @@ impl From<&Doodad> for Doodad {
53
53
value. clone ( )
54
54
}
55
55
}
56
+ #[ doc = "OuterThing" ]
57
+ #[ doc = r"" ]
58
+ #[ doc = r" <details><summary>JSON schema</summary>" ]
59
+ #[ doc = r"" ]
60
+ #[ doc = r" ```json" ]
61
+ #[ doc = "{" ]
62
+ #[ doc = " \" type\" : \" object\" ," ]
63
+ #[ doc = " \" properties\" : {" ]
64
+ #[ doc = " \" thing\" : {" ]
65
+ #[ doc = " \" title\" : \" ThingWithDefaults\" ," ]
66
+ #[ doc = " \" default\" : {" ]
67
+ #[ doc = " \" type\" : \" bee\" " ]
68
+ #[ doc = " }," ]
69
+ #[ doc = " \" type\" : \" object\" ," ]
70
+ #[ doc = " \" properties\" : {" ]
71
+ #[ doc = " \" a\" : {" ]
72
+ #[ doc = " \" type\" : \" string\" " ]
73
+ #[ doc = " }," ]
74
+ #[ doc = " \" type\" : {" ]
75
+ #[ doc = " \" type\" : \" string\" " ]
76
+ #[ doc = " }" ]
77
+ #[ doc = " }," ]
78
+ #[ doc = " \" additionalProperties\" : false" ]
79
+ #[ doc = " }" ]
80
+ #[ doc = " }" ]
81
+ #[ doc = "}" ]
82
+ #[ doc = r" ```" ]
83
+ #[ doc = r" </details>" ]
84
+ #[ derive( Clone , Debug , Deserialize , Serialize ) ]
85
+ pub struct OuterThing {
86
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
87
+ pub thing : Option < ThingWithDefaults > ,
88
+ }
89
+ impl From < & OuterThing > for OuterThing {
90
+ fn from ( value : & OuterThing ) -> Self {
91
+ value. clone ( )
92
+ }
93
+ }
56
94
#[ doc = "TestBed" ]
57
95
#[ doc = r"" ]
58
96
#[ doc = r" <details><summary>JSON schema</summary>" ]
@@ -99,6 +137,50 @@ impl From<&TestBed> for TestBed {
99
137
value. clone ( )
100
138
}
101
139
}
140
+ #[ doc = "ThingWithDefaults" ]
141
+ #[ doc = r"" ]
142
+ #[ doc = r" <details><summary>JSON schema</summary>" ]
143
+ #[ doc = r"" ]
144
+ #[ doc = r" ```json" ]
145
+ #[ doc = "{" ]
146
+ #[ doc = " \" title\" : \" ThingWithDefaults\" ," ]
147
+ #[ doc = " \" default\" : {" ]
148
+ #[ doc = " \" type\" : \" bee\" " ]
149
+ #[ doc = " }," ]
150
+ #[ doc = " \" type\" : \" object\" ," ]
151
+ #[ doc = " \" properties\" : {" ]
152
+ #[ doc = " \" a\" : {" ]
153
+ #[ doc = " \" type\" : \" string\" " ]
154
+ #[ doc = " }," ]
155
+ #[ doc = " \" type\" : {" ]
156
+ #[ doc = " \" type\" : \" string\" " ]
157
+ #[ doc = " }" ]
158
+ #[ doc = " }," ]
159
+ #[ doc = " \" additionalProperties\" : false" ]
160
+ #[ doc = "}" ]
161
+ #[ doc = r" ```" ]
162
+ #[ doc = r" </details>" ]
163
+ #[ derive( Clone , Debug , Deserialize , Serialize ) ]
164
+ #[ serde( deny_unknown_fields) ]
165
+ pub struct ThingWithDefaults {
166
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
167
+ pub a : Option < String > ,
168
+ #[ serde( rename = "type" , default , skip_serializing_if = "Option::is_none" ) ]
169
+ pub type_ : Option < String > ,
170
+ }
171
+ impl From < & ThingWithDefaults > for ThingWithDefaults {
172
+ fn from ( value : & ThingWithDefaults ) -> Self {
173
+ value. clone ( )
174
+ }
175
+ }
176
+ impl Default for ThingWithDefaults {
177
+ fn default ( ) -> Self {
178
+ ThingWithDefaults {
179
+ a : Default :: default ( ) ,
180
+ type_ : Some ( "bee" . to_string ( ) ) ,
181
+ }
182
+ }
183
+ }
102
184
#[ doc = r" Generation of default values for serde." ]
103
185
pub mod defaults {
104
186
pub ( super ) fn doodad_when ( ) -> chrono:: DateTime < chrono:: offset:: Utc > {
0 commit comments