How can I limit the available values of an enum for a given type #2163
Unanswered
pavel-savchenko-deel
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm following docs and using a string alias with enum constants to indicate the type on my struct (automatic via swago).
But, in my package, I also define additional constants that are special, such as
const DefaultDifficulty = Easy(see type Difficulty string). Trouble is that automatic schema generator for enum picks them up twice, so in effect our enum array has easy twice,["easy", "medium", "hard", "easy"].I'm using swago v2 because I want it to generate OAS3.
didn't test with v1 (I think it may have already had a fix for it, because I can't see this issue in some old v1 generated schema)Update: I can confirm that this issue doesn't happen in v1. And it appears in both OAS 2 and OAS 3.1 output. (with or without --v3.1 flag)Does anyone know of a way to work around this (maybe a 'skip' option), or should this be reported as a bug?
Beta Was this translation helpful? Give feedback.
All reactions