Springfox: Producing "x-example" with @ApiParam for @PathVariable

Created on 15 Feb 2018  ·  3Comments  ·  Source: springfox/springfox

I'm curious about getting "x-example" in the json output using annotations in Spring REST controllers.

Currently, I'm attempting this in my controller:

@Override
public ResponseEntity<Object> update(
  @RequestBody @Valid UpdateCampaignRequest updateCampaignRequest,
  @ApiParam(name = "campaign_id", example = "1", required = true) @PathVariable("campaign_id") Long campaignId) { ... }

...in the method parameters of the rest controller method signature.

This however, produces no x-example in the swagger json output (converted to yml by me):

parameters:
  - name: campaign_id
    in: path
    description: campaign_id
    required: true
    type: integer
    format: int64

Is there another way to accomplish this?

These are my dependencies:

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>2.8.0</version>
</dependency>
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>2.8.0</version>
</dependency>
feature help-wanted

Most helpful comment

Many thanks for this feature!

All 3 comments

Example isn't supported on parameters yet.

@dilipkrish When can springfox support this feature?or which version?

Many thanks for this feature!

Was this page helpful?
0 / 5 - 0 ratings