问题
Problem/Scenario
I have a basic REST API project with SpringBoot 1.4.7.RELEASE and I'm using springfox/swagger for documentation.
We started couple years ago using
io.springfox:springfox-swagger2:2.9.0
io.springfox:springfox-swagger-ui:2.9.0
Any given day we'd replaced springfox-swagger-ui by its /dist folder and some customizations were applied.
So far so forth, everything was fine.
Now, I'm doing method overloading in @RestController for the same endpoint/HTTP verb and that is not really supported by Swagger-UI.
My @RestController looks like below:
@GetMapping("/people")
public ResponseEntity<List<PeopleDTO>> getAllPeople(Pageable pageable){...}
@GetMapping(value="/people", params={"keys", "values"})
public ResponseEntity<List<PeopleDTO>> getPerson(@ApiIgnore @RequestParam MultiValueMap<String, String> pk){...}
Side note: Believe me, I know this is not RESTfull at all, but I'm dealing with a legacy system with composite keys and.., well, my point here is Swagger UI.
Well, with GetMapping.params and enabling flag enableUrlTemplating on my Docket it really seems to work and the endpoints got visible in the ui:
v2/people{?page,size} getAllPeople
v2/people{?keys,values} getPerson
Even though executing both methods through cURL is possible, I'm getting 404 when using Swagger-Ui, because the keys are not being removed from the URL before submitting:
http://localhost:8081/api/v2/people%7B?keys%2Cvalues%7D=&keys=keyOne&values=valueOne
Question
I'm aware of
io.springfox.ui:springfox-swagger-ui-rfc6570:1.0.0
And I've tried it on my project where it worked fine.
However, springfox-swagger-ui-rfc6570 uses swagger-ui 2.2.6 which is very different stack from springfox-swagger-ui:2.9.0 which uses swagger-ui 3.13.6.
I'm looking for some advice in how to proceed to apply same "rfc6570" changes in swagger-ui 3.13.6 or maybe some other approach that could help me document this unconventional business requirement keeping my swagger-ui customizations.
来源:https://stackoverflow.com/questions/59096880/swagger-ui-support-for-overloaded-methods-springfox-swagger-ui-2-9-0-rfc6570