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 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

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"]
}

@bwbroersma
Copy link
Author

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"]
  }
}

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

No branches or pull requests

2 participants