Skip to content

@ApiParam - Allowable values not displayed in Swagger API docs #1244

Closed

Description

@jfiala

Version 2.4.0

If e.g. @ApiParam(allowableValues="range[1, 11]") is set, it is never displayed in the API docs (minLength=1, maxLength=11).
It doesn't work directly for a Request parameter:

@RequestParam @ApiParam(value="description", allowableValues="range[1, 11]") String sample;

It also doesn't work if the parameter is declared using @ModelAttribute.

For @ApiModelProperty it works as desired:

@ApiModelProperty(value="description", allowableValues="range[1, 11]")

=> will display minLength=1, maxLength=11.

Can you pls check why this is missing for @ApiParam?

Activity

  1. jfiala commented on Mar 30, 2016

    @jfiala
    ContributorAuthor

    In fact, this also affects other ParameterBuilderPlugin / ExpandedParameterBuilderPlugin who also set allowableValues, but it never shows up in the API docs.

  2. added this to the 2.5.0 milestone on Apr 6, 2016
  3. jfiala commented on Apr 9, 2016

    @jfiala
    ContributorAuthor

    This had to be fixed in springfox.documentation.swagger2.mappers.EnumMapper, there was only support for AllowableListValues implemented. Added AllowableRangeValues with PR #1254.

  4. dilipkrish commented on May 27, 2016

    @dilipkrish
    Member
  5. added a commit that references this issue on Feb 25, 2017
  6. added a commit that references this issue on May 31, 2018
  7. johnsonlegend commented on Jul 18, 2019

    @johnsonlegend

    tested version 2.8.0 and 2.9.2, looks like it's not working as expected

  8. hiejulia commented on Jul 23, 2020

    @hiejulia

    Is it fixed yet ? Same problem happened with swagger-jersey2-jaxrs.

  9. dilipkrish commented on Jul 23, 2020

    @dilipkrish
    Member

    Yes it should be. Please move to 3.0.0. Also swagger-jersey2-jaxrs is not part of this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions