Springfox: @ApiParam example value not working

Created on 2 Sep 2018  路  3Comments  路  Source: springfox/springfox

I am trying to provide example value for Request parameter which is a query string but nothing is appearing.

@RequestMapping(value = "/test", consumes = {MediaType.TEXT_PLAIN_VALUE},produces = { "application/json" }, method = RequestMethod.POST)
    public ResponseEntity<List<Docket>> getDetails(  @ApiParam( example="test",required = true, defaultValue = "1", name = "query") @RequestBody String query){

screen shot 2018-09-02 at 8 14 12 pm

2.9.2

investigating

Most helpful comment

Any updates on this?

All 3 comments

+1

Not only the example field, but also the "Format" field doesn't seem to work either.

I.E:

    public ResponseEntity modelSBA(@ApiParam(required = true, format = "date") @RequestParam("effDate") String effDate,
            @ApiParam(required = true, example = "testHiearchy") @RequestParam("hierarchy") String hierarchy,
            @ApiParam(example = "select:http://{analytics-service}/analytics") @RequestParam("analyticsId") List<String> analytics
    )

Gives the following json

```json
"parameters": [{
"name": "analyticsId",
"in": "query",
"description": "analyticsId",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi",
"allowEmptyValue": false
}, {
"name": "effDate",
"in": "query",
"description": "effDate",
"required": true,
"type": "string",
"allowEmptyValue": false
}, {
"name": "hierarchy",
"in": "query",
"description": "hierarchy",
"required": true,
"type": "string",
"allowEmptyValue": false
}
]
````

Ignoring the "example" field

similary, if i change from example to format, it's ignored too

Any updates on this?

This problem still occurs on v 3.0.0 using DocumentationType.OAS_30

Was this page helpful?
0 / 5 - 0 ratings