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

enum values not displayed in example/model view (resubmitted using template) #3761

Open
jcferrer opened this issue Oct 14, 2017 · 6 comments

Comments

@jcferrer
Copy link

jcferrer commented Oct 14, 2017

ENUM values in the schema definition are not displayed in the example/model view sections of the swagger-ui page.

Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? 2.0
Which Swagger-UI version? 3.3.1
How did you install Swagger-UI? embedded in swagger-tools module
Which browser & version? Safari Version 11.0 (12604.1.38.1.7)
Which operating system? macOS Sierra Version 10.12.6 (16G29)

Demonstration API definition

accessTokenReq:
    type: object
    properties:
      grant_type:
        enum:
          - client_credentials
      client_id:
        type: string
      client_secret:
        type: string

Expected Behavior

Rendered by UI:

Example section:

{
  "grant_type": "client_credentials",
  "client_id": "string",
  "client_secret": "string"
}

Model section

accessTokenReq { 
  grant_type  = ['client_credentials'],
  client_id | string
  client_secret | string
}

Current Behavior

Rendered by UI:

Example section:

{
  "client_id": "string",
  "client_secret": "string"
}

Model section

accessTokenReq {
  grant_type {
  }
  client_id | string
  client_secret | string
}

Possible Solution

Context

@webron
Copy link
Contributor

webron commented Oct 16, 2017

While this is a bug, you can easily overcome it by explicitly adding the type.

  accessTokenReq:
    type: object
    properties:
      grant_type:
        type: string
        enum:
          - client_credentials
      client_id:
        type: string
      client_secret:
        type: string

@awalsh-broadsoft
Copy link

Hi, is this bug being considered for a future fix? I like the work around in the mean time, but it'd be nice to know if there a fix coming as well. Thanks.

@webron
Copy link
Contributor

webron commented Nov 13, 2017

@awalsh-broadsoft we have no immediate plans to work on this issue.

@ralpha
Copy link

ralpha commented May 11, 2020

Still have this issue in 2020...
I guess I'll try the type setting workaround.

@dakl
Copy link

dakl commented Jan 27, 2022

Any updates in this issue?

@brothercoyote
Copy link

Still happens...
UP-UP-UP!

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

No branches or pull requests

6 participants