@@ -144,10 +144,16 @@ export function deserializeBarParser(barResponse: BarResponse | undefined = {}):
144
144
} ;
145
145
}
146
146
147
- export function serializeTestObject ( writer : SerializationWriter , entity : { additionalData ?: Record < string , unknown > } | undefined = { } ) : void {
148
- writer . writeAdditionalData ( entity . additionalData ) ;
149
- }
150
- export function serializeTestParser ( writer : SerializationWriter , entity : TestParser | undefined = { } ) : void {
147
+ export function serializeTestObject ( writer : SerializationWriter , entity : { additionalData ?: Record < string , unknown > } | undefined | null = { } ) : void {
148
+ if ( ! entity ) {
149
+ return ;
150
+ }
151
+ writer . writeAdditionalData ( entity . additionalData ) ;
152
+ }
153
+ export function serializeTestParser ( writer : SerializationWriter , entity : TestParser | undefined | null = { } ) : void {
154
+ if ( ! entity ) {
155
+ return ;
156
+ }
151
157
writer . writeStringValue ( "id" , entity . id ) ;
152
158
writer . writeCollectionOfPrimitiveValues ( "testCollection" , entity . testCollection ) ;
153
159
writer . writeStringValue ( "testString" , entity . testString ) ;
@@ -170,18 +176,27 @@ export function serializeTestParser(writer: SerializationWriter, entity: TestPar
170
176
writer . writeCollectionOfEnumValues ( "nextStatuses" , entity . nextStatuses ) ;
171
177
}
172
178
173
- export function serializeFoo ( writer : SerializationWriter , entity : FooResponse | undefined = { } ) : void {
179
+ export function serializeFoo ( writer : SerializationWriter , entity : FooResponse | undefined | null = { } ) : void {
180
+ if ( ! entity ) {
181
+ return ;
182
+ }
174
183
writer . writeStringValue ( "id" , entity . id ) ;
175
184
writer . writeCollectionOfObjectValues ( "bars" , entity . bars , serializeBar ) ;
176
185
}
177
186
178
- export function serializeBar ( writer : SerializationWriter , entity : BarResponse | undefined = { } ) : void {
187
+ export function serializeBar ( writer : SerializationWriter , entity : BarResponse | undefined | null = { } ) : void {
188
+ if ( ! entity ) {
189
+ return ;
190
+ }
179
191
writer . writeStringValue ( "propA" , entity . propA ) ;
180
192
writer . writeStringValue ( "propB" , entity . propB ) ;
181
193
writer . writeDateValue ( "propC" , entity . propC ) ;
182
194
}
183
195
184
- export function serializeTestBackModel ( writer : SerializationWriter , entity : TestBackedModel | undefined = { } ) : void {
196
+ export function serializeTestBackModel ( writer : SerializationWriter , entity : TestBackedModel | undefined | null = { } ) : void {
197
+ if ( ! entity ) {
198
+ return ;
199
+ }
185
200
serializeTestParser ( writer , entity ) ;
186
201
}
187
202
@@ -198,7 +213,10 @@ export function deserializeIntoTestUnionObject(fooBar: Partial<TestUnionObject>
198
213
} ;
199
214
}
200
215
201
- export function serializeTestUnionObject ( writer : SerializationWriter , fooBar : Partial < TestUnionObject > | undefined = { } ) : void {
216
+ export function serializeTestUnionObject ( writer : SerializationWriter , fooBar : Partial < TestUnionObject > | undefined | null = { } ) : void {
217
+ if ( ! fooBar ) {
218
+ return ;
219
+ }
202
220
serializeFoo ( writer , fooBar as FooResponse ) ;
203
221
serializeBar ( writer , fooBar as BarResponse ) ;
204
222
}
0 commit comments