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 array support #1353

Open
bwbroersma opened this issue Jul 18, 2019 · 2 comments
Open

Enum array support #1353

bwbroersma opened this issue Jul 18, 2019 · 2 comments
Labels

Comments

@bwbroersma
Copy link

@bwbroersma bwbroersma commented Jul 18, 2019

Enum looks nice in SwaggerUI, enum arrays do not.
Here the changes that work for me for nice SwaggerUI output, but it might not be correct for the OpenAPI standard: code diff

@bwbroersma
Copy link
Author

@bwbroersma bwbroersma commented Jul 25, 2019

Ok the previous commit / provided solution is not the correct way to do it, this will also result in an
Example Value

{
  "the-enum-array-field": "first-value"
}

were we would want more something like

{
  "the-enum-array-field": ["first-value"]
}

Loading

@bwbroersma
Copy link
Author

@bwbroersma bwbroersma commented Jul 26, 2019

The correct Swagger to output (according to the docs) is:

{
  "format": "schema.typename[]",
  "type": "array",
  "items": {
    "type": "string",
    "enum": ["first-value", "second-value"]
  }
}

Loading

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

Successfully merging a pull request may close this issue.

None yet
2 participants