-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Swift] Enum parameters are now handled #2640
Conversation
This won't compile if multiple operations have the same enum. Maybe you could prepend the operationId to the enum type? |
@fabdslv thanks for the PR. @yonaskolb thanks for reviewing. I've a PR for C# and PHP (#2508) and should work for multiple operations with the same enum defined. I'll try to incorporate your change into my PR. |
Well it will break in swift if there are multiple operations with the same tag that share any enums with the same name, as they are in the same scope |
The rawValue of the enum will also need to be extracted when added to the path parameters or the nillableParameters, otherwise they will use the printed escaped enum name which may be different from the actual value |
@yonaskolb Yes, it might be a good solution to add the operational id. I'm not sure I understand your last comment though, what do you mean by extract the |
well for the path params instead of and for the query params instead of I hope that makes sense. That's what I've done in my custom templates |
@yonaskolb when you've time, do you mind submitting your custom template change with a PR so that we can review and compare? Thanks! |
I updated the PR to integrate what @yonaskolb was mentioning. Apart from the fact that it fixes the issues, now the Enum name is @wing328 It seems that some changes were made in master that affect my commit and I cannot rebase from master. Could you please take a look at this if you have time? Thanks. |
|
||
enum for parameter {{paramName}} | ||
*/ | ||
public enum {{{datatypeWithEnum}}}_{{operationId}}: String { {{#allowableValues}}{{#values}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is solving the possible clash issue. But for people that don't have a clash, this is created a cumbersome API. Maybe we should add some logic Java-side to know if we have a conflict and do that only in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wing328 I managed to rebase, it should be okay now. |
Fix #2531