Closed Kastet closed 5 years ago
Yeah that’s an interesting addition. Another way would be to have an option that makes all enums like this optional
True. Though an unknown
case seems to be more explicit and probably harder to misinterpret.
I can add this and send a PR if you are happy with the suggestion
Yeah, go for it!
Context
As API payloads evolve they need to be backwards compatible with the older versions of mobile clients. Generally, adding new fields and removing optional fields is safe. Changes in field names and types aren't safe but not often required. What does happen often is new cases get added to
enum
andoneOf
types. For example:If a new type
payPal
needs to be added without braking the existing clients I'd have to create a new version of the endpoint.Suggestion
Add an option to SwagGen to generate an additional
unknown
case to enum type properties in models.