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

Disable Suffixes for OperationId #2481

Closed
ra-lukas opened this issue Jan 9, 2024 · 2 comments
Closed

Disable Suffixes for OperationId #2481

ra-lukas opened this issue Jan 9, 2024 · 2 comments
Labels
invalid This doesn't seem right

Comments

@ra-lukas
Copy link

ra-lukas commented Jan 9, 2024

Back in the days of SpringFox, there were several requests to be able to change and/or disable the unique suffixes appended to the operationIds. While there were a few workarounds, the option to completely disable all suffixes never materialized.

The main issue is when multiple RestControllers follow the same naming convention for methods. For example, if I have multiple getById() methods, they will receive a suffix number when generated. For example, getById() might become getById_5 as an operationId. This happens even if the different getById() methods exist in different controllers.

These suffixes become a problem when using a code generator such as openapi-generator (https://openapi-generator.tech/). Even if generating to a unique class in strongly typed language like TypeScript, the method is still named after the operationId, with the suffix. Upon subsequent compiles and deploys, that number might change, which forces the API consumers to alter their code.

I may have missed something in how to avoid this, or perhaps there is a new solution, but I feel the easiest would be to have a property to disable the unique suffix.

Links for historical context.
springfox/springfox#1224 (comment)
https://stackoverflow.com/a/38828012/203498

@bnasslahsen
Copy link
Contributor

@ra-lukas,

Suffixes are only generated to have unique operations names in the generated spec.
If you want to avoid it, you can rename your non-unique operation names.

@bnasslahsen bnasslahsen added the invalid This doesn't seem right label Feb 27, 2024
@Farley-Chen
Copy link

see #675 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants