Skip to content

Support custom operationId #1763

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

Closed
xiaoxiangmoe opened this issue Jul 27, 2022 · 1 comment
Closed

Support custom operationId #1763

xiaoxiangmoe opened this issue Jul 27, 2022 · 1 comment
Labels
question Further information is requested

Comments

@xiaoxiangmoe
Copy link
Contributor

xiaoxiangmoe commented Jul 27, 2022

@RestController
public class HelloController {
	@GetMapping(value = "/hello/index")
	public String index() {
		return "Greetings Hello from Spring Boot!";
	}
}
@RestController
public class HiController {
	@GetMapping(value = "/hi/index")
	public String index() {
		return "Greetings Hi from Spring Boot!";
	}
}

In springdoc, it will generate two operations with operationId: index and index_1.

{
  "openapi": "3.0.1",
  "info": { "title": "OpenAPI definition", "version": "v0" },
  "servers": [
    { "url": "http://localhost:8080", "description": "Generated server url" }
  ],
  "tags": [],
  "paths": {
    "/hi/index": {
      "get": {
        "tags": ["hi-controller"],
        "operationId": "index",
        "responses": {
          "200": {
            "description": "OK",
            "content": { "*/*": { "schema": { "type": "string" } } }
          }
        }
      }
    },
    "/hello/index": {
      "get": {
        "tags": ["hello-controller"],
        "operationId": "index_1",
        "responses": {
          "200": {
            "description": "OK",
            "content": { "*/*": { "schema": { "type": "string" } } }
          }
        }
      }
    } 
  },
  "components": {
    "schemas": {}
  }
}

Can we config operationId to controller name + method name?

Such as hiControllerIndex and helloControllerIndex?

@xiaoxiangmoe
Copy link
Contributor Author

see #675 (comment)

@bnasslahsen bnasslahsen added the question Further information is requested label Jul 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants