yonaskolb / SwagGen

OpenAPI/Swagger 3.0 Parser and Swift code generator
MIT License
625 stars 146 forks source link

Issue with decoding when element is nullable array #305

Open AndyBond2007 opened 2 years ago

AndyBond2007 commented 2 years ago

If you take the following array:

[ {"id": 1, "name" : "test", "tags" : ["tag1", "tag2"]}, {"id":2, "name":"test2", "tags":null}]

it fails on decode with the error: Expected to decode Array but found a null value instead.

the "tags" element is correctly defined in the model as [String]? and the swagger document shows it is nullable.

It its possible to get around this by using the SafeOptionalDecoding:true option, but I would not have expected that to be required.