Springfox: Bad URL when using "try it out!" swagger ui functionality with RequestParam (query param)

Created on 12 Aug 2015  路  3Comments  路  Source: springfox/springfox

Hello,

my api method is design like this in my spring-boot application :

@RequestMapping(value = "/api/v1/party/{msisdn}", method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
public ApiPartyResponse party(@PathVariable String msisdn, @RequestParam("source") PartySourceRestriction partySourceRestriction, @RequestParam String fileId) throws BusinessException {

i use theses dependency for dealing with swagger stuff

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.1.2</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.1.2</version>
        </dependency>

my api is working well, my swagger ui is ok too but the "try it out!" button don't work because generated path is not good.

as you can see on screenshot bellow, "{?source,fileId}" in path should not be here.
Is it a bug in swagger json generation, on swagger ui or in my usage of all of that ?

image

thanks for helping.

regards.

question

Most helpful comment

Hi!

If I disable enableUrlTemplating then we end up with https://github.com/springfox/springfox/issues/750 for some other APIs. What would you suggest?

Thanks!

All 3 comments

Disable enableUrlTemplating In your docket and that will fix your problem

thanks ! it's working now.

Hi!

If I disable enableUrlTemplating then we end up with https://github.com/springfox/springfox/issues/750 for some other APIs. What would you suggest?

Thanks!

Was this page helpful?
0 / 5 - 0 ratings