Wrong operationid generated
See original GitHub issueHello, This bug is probably the same as bug 96. OperationID continues to be generated with a suffix, even when there’s no other method with the same operationid in the same class.
This issue is easy to reproduce:
- Create two controllers classes.
- Create one method with the same name in both classes.
- http://yoursite/v3/api-docs will produce one operationid correct and the other will have the 1 suffix.
Ex: MyFirstClass.java:
@Operation(operationId = "save")
@PostMapping(path = "/")
@ApiResponse(responseCode = "200", description = "Success")
public ResponseEntity save(@RequestBody String request) {
return null;
}
MySecondClass.java:
@Operation(operationId = "save")
@PostMapping(path = "/")
@ApiResponse(responseCode = "200", description = "Success")
public ResponseEntity save(@RequestBody String request) {
return null;
}
After generation, one method will have the correct operationid (save), but the other one will have a wrong operationid(save_1) This bug is happening with SpringDoc 1.3.0, SpringBoot 2.2.6, openJDK 11 64bits on Windows.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to customize the value of operationId generated in api ...
I have configured my spring project using springfox 2.0. I am able to generate the open api spec with it. ... This operationId...
Read more >Rules - Redocly
OpenAPI-generated documentation tool with 17000+ stars on Github - for ... rules: specific-api-rule: warn rules: example-rule-name: error.
Read more >Path Operation Advanced Configuration - FastAPI
You can set the OpenAPI operationId to be used in your path operation with the ... To exclude a path operation from the...
Read more >API Standardization | SwaggerHub Documentation
To view the error list, open an API in the SwaggerHub editor and check the Validation ... API documentation also uses operationId to...
Read more >Links - Swagger
HTTP/1.1 201 Created; Content-Type: application/json ... operationId is used for local links only, and operationRef can link to both ... Found a mistake?...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Nvm - I just realized there is an
OperationCustomizer
class while browsing the source code -https://github.com/springdoc/springdoc-openapi/blob/2da39aae2976ef1cc888e5696caf763fb6f05fcf/springdoc-openapi-common/src/main/java/org/springdoc/api/AbstractOpenApiResource.java#L641
I was able to provide a bean and customize my generated names =]
Thanks for a great project!!
Thank you @bnasslahsen for the quick response. It just think it doesn’t make any sense. For instance, I’m generating REST calls to Angular in typescript. In this situation, I have two calls: