Skip to content
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

Method Names postfixed with Numbers #1952

Open
donkey-donkey opened this issue Dec 23, 2023 · 7 comments
Open

Method Names postfixed with Numbers #1952

donkey-donkey opened this issue Dec 23, 2023 · 7 comments
Assignees

Comments

@donkey-donkey
Copy link

donkey-donkey commented Dec 23, 2023

When we use a
get
/apples/:id
and a get all
/apples/
the second one listed in the schema will turn into apples1 function in the generated code.

isnt the openapi spec to have the endpoints both named apples? but then we get silly apples1 function name?
am i missing something?

thanks

@andreujuanc
Copy link

andreujuanc commented Feb 18, 2024

I think it's because both are under the same Tag? I'm currently looking for a way to set an operationId on my spec to set the method name to something better.

EDIT: See #314

@mrlubos
Copy link
Collaborator

mrlubos commented Feb 20, 2024

@donkey-donkey @andreujuanc can you try our fork if that works as you'd expect?

@andreujuanc
Copy link

andreujuanc commented Feb 20, 2024

Can't at the moment. But just for the record, the current lib will use the operationId for naming, so that should be good enough if you have control over the spec.

EDIT: Gave it a star. Will check as soon as I can.

@askvortcov
Copy link

askvortcov commented Feb 20, 2024

As @mrlubos pointed out, this might be resolved by #2043.

@mrlubos
Copy link
Collaborator

mrlubos commented Feb 20, 2024

You'll want to set the new --useOperationId flag to false to try the alternative method name generator. It's available in the latest release, please let us know whether it worked if you try it

@andreujuanc
Copy link

I think OP was asking "why the number suffix", and the answer is because I believe there is no operationId on their spec, and the paths are both on the same Tags. Ignoring the operationId would yield no change to the generated methods.

@mrlubos
Copy link
Collaborator

mrlubos commented Feb 20, 2024

@andreujuanc the pull request also changes the replacement pattern so I'd expect a different result for their use case, but will need them to try it since I can't see their OpenAPI spec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants