Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ServerVariable without allowed values not well rendered #3071

Closed
blackat opened this issue Jan 10, 2019 · 1 comment
Closed

@ServerVariable without allowed values not well rendered #3071

blackat opened this issue Jan 10, 2019 · 1 comment

Comments

@blackat
Copy link

blackat commented Jan 10, 2019

Hello,
I have this description

@OpenAPIDefinition(
        info = @Info(
                title = "My Rest API",
                version = "1.0.0",
                description = "My RESTful API implementation"
        ),
        servers = {
                @Server(
                        description = "My REST API",
                        url = "/{context-path}/{rest-api}",
                        variables = {
                                @ServerVariable(name = "context-path", defaultValue = "my-war"),
                                @ServerVariable(name = "rest-api", defaultValue = "api", allowableValues = {"api", "rest", "batchapi"})
                        }
                )
        }
)

I use the swagger-maven-plugin version 2.0.6 to generate the JSON in open api 3.0 format.
I obtain this JSON

"servers" : [ {
    "url" : "/{context-path}/{rest-api}",
    "description" : "My REST API",
    "variables" : {
      "context-path" : {
        "default" : "my-war",
        "enum" : [ "" ]
      },
      "rest-api" : {
        "default" : "api",
        "enum" : [ "api", "rest", "batchapi" ]
      }
    }
  } ],

The problem is the empty "enum" : [ "" ] that in the swagger-ui is rendered as an empty dropdown. Without the empty enum there is an input field with the default value so it is possible to set a different context path.

Is there please a workaround?

@frantuma
Copy link
Member

frantuma commented Feb 5, 2019

Thanks for reporting this! fixed in #3110.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants