yonaskolb / SwagGen

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

Added anyType template option #229

Closed tapoton closed 4 years ago

tapoton commented 4 years ago

Added anyType template option to be able to replace, for example Any or [String: Any] with AnyCodable and [String: AnyCodable].

Did not find a way to do it using only template.

mackoj commented 4 years ago

I think it’s a great addition ! I did often do it in my template too.

Please consider updating the Changelog and Readme files.

I will even propose it to enable by default.

Thanks for tour contribution @tapoton.

yonaskolb commented 4 years ago

Hi @tapoton, thanks for the PR! As @mackoj noted could you please also add:

tapoton commented 4 years ago

Hi! Added necessary changes, enabled anyType: AnyCodable override in default template

tapoton commented 4 years ago

Looks like all changes made by FixturesTests are valid. Please, take a look

mackoj commented 4 years ago

FWIW I have no authority to do code review I'm just trying to helping you.

Please @tapoton could you consider moving it default value to Any as @yonaskolb requested and I think you will be in a good place ;).

And add a small comment behind the configuration in Templates/Swift/template.yml.

Thanks,

tapoton commented 4 years ago

My bad, didn't get that at first. Done

mackoj commented 4 years ago

@tapoton should your feature use the same option as codableResponses ? Because the goal of codableResponses is to made the model Codable.

yonaskolb commented 4 years ago

I think this can stay separate to codableResponses