Skip to content

Support @RequestMapping.param for overloaded endpoints #15

Closed
@membersound

Description

@membersound

In spring it is possible to create multiple endpoints on the same path, that only differ by parameters.

@RestController
public class SearchController {
    @GetMapping(path = "/items", params = "name")
    public Object searchItemsByName(String name) {

    }

    @GetMapping(path = "/items", params = "description")
    public Object searchItemsByDescription(String description) {

    }
}

It would be nice if springdoc could render those endpoints as 2 distinct endpoints, so that both are shown individually.

If we'd make the query parameters a bean here, maybe you could detect the overloaded endpoints, and generate parameters.schema.oneOf? But I'm not sure if that would help.

{
 "path": {
   "/items:" {
     "get": {
       "parameters": [
	 {
	    "name": "req",
	    "in": "query",
	    "schema": {
		"oneOf": [
		    {
		        "$ref": "#/components/schemas/FirstFilter"
		    },
		    {
		        "$ref": "#/components/schemas/SecondFilter"
		    }
		]
	    }
	 }
       ]
     }
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions