-
-
Notifications
You must be signed in to change notification settings - Fork 524
@Schema annotation with type String and allowableValues set doesn't generate enum drop-down in swagger-ui after upgrading from 1.6.6 (when Spring custom converter is used) #1663
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
Comments
Ok, digged a little bit more into this and it seems this is about spring custom converter used for that enum. If I remove converter then everything works in 1.6.8 as expected with plain enum and with decorating schema-annotation. It seems there has been some fixes for custom converters, e.g. this one #1534 . Need to check it in more detail if it explains this behaviour. |
As a workaround you could move @Schema-annotation for enum directly to controller(s) parameters, but obviously this isn't an optimal solution, because then you'll need to duplicate it for every place where that enum type is used. So, I think this should be fixed in a way, that @Schema-annotation of some type will be respected even if spring custom converter is involved. |
Your description is not clear. |
@bnasslahsen I have made a sample project to help reproducing the described behavior easily. Please see: https://github.com/solita-alperttiti/springdoc-enum-example |
Should be fixed with the next release. This is the workaround, until then @GetMapping(value = "/example/{fooBar}")
public String getFooBar(@PathVariable @Parameter(schema = @Schema(allowableValues = { "foo", "bar" })) FooBar fooBar) {
return fooBar.name();
} |
…enerate enum drop-down in swagger-ui after upgrading from 1.6.6 (when Spring custom converter is used). Fixes #1663.
…es set doesn't generate enum drop-down in swagger-ui after upgrading from 1.6.6 (when Spring custom converter is used) #1663
Describe the bug
After upgrading from springdoc-openapi 1.6.6 to 1.6.7/1.6.8 enum drop-down is not visible in swagger-ui.
EDIT: problem is most likely a custom converter with enum (plain or decorated with schema-annotation). More details from comments.
This works with 1.6.6. as expected, but in 1.6.7/1.6.8 there is only normal empty text-field and not the enum drop-down with allowable values:
And enum is used as pathvariable in controller:
2.6.7
1.6.6 works, 1.6.7/1.6.8 doesn't
The text was updated successfully, but these errors were encountered: