-
I'm trying to generate an OpenAPI 3.1 spec for a query parameter that can take multiple values from a set of values. is there a way to do this using struct tags? The struct definition I tried / expected to work. It works for single enum, but not for arrays.
Generated output.
Desired output.
Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
vearutop
Jun 27, 2024
Replies: 1 comment 2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
enum=
should beenum:
in field tag, but that would still be something you don't want.Field tags are applied to fields, you want
enum
for an item of a slice that's held by the field.There is no attempt to apply filed tags to field sub elements, because that would be a misleading behavior due to large variety of possible kinds of sub elements with undefined expectations, e.g.
[][]string
,[]int
,map[string]map[int]bool
, etc...https://go.dev/play/p/bn12aLBhtiK