简体   繁体   中英

Swagger or springfox ignore Pageable param

I am trying to construct swagger documentation using springfox.

My rest method is

@RequestMapping(value = "/filter", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public final Page<SomeOtherObj> filter(@RequestBody SomeObj dto, Pageable pageable) {...}

and in output I have documentation with parametr list:

"parameters": [
    {
        "in": "body",
        "name": "dto",
        "description": "dto",
        "required": true,
        "schema": {
            "$ref": "#/definitions/SomeOdj"
        }
    }
],

Where is Pageable? Why does it ignore by swagger?

My guess is since it's not marked with @RequestBody it's getting ignored. Anyway, you can implicitly mark it with @ApiParam annotation. It should be included to final spec.

@RequestMapping(value = "/filter", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public final Page<SomeOtherObj> filter(@RequestBody SomeObj dto, @ApiParam(name = "Pageable filter", required = false) Pageable pageable) {...}

Update

As per comments

Issues happens in v 2.8.0 . Everything is OK in new version 2.9.0 of Springfox Swagger. And it works fine in older versions (I tried 2.6.1 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM