yonaskolb / SwagGen

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

Generator is failing on enums as well. #211

Open goors opened 4 years ago

goors commented 4 years ago

I got in swagger like someStatus oneOf SomeStatusEnum but that is generated like someStatus: [String: Any], and that is wrong since SomeStatusEnum can be Active=1, NotActive=0. So imagine I have like tons of that enum dudes and I have to remember all the values instead of saying something like SomeStatusEnum.Active.

So the way this is generated is more of less useless.

goors commented 4 years ago

Look at the raw request for this:

{"someStatus":{"0":1}}

Instead of {"someStatus":1}

yonaskolb commented 4 years ago

It sounds like you need to be using enum instead of oneOf in your spec. You'll need to provide some more information