swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

Question: Is there a way to specify allowableValues dynamically?

Open vitaliid opened this issue 5 years ago • 4 comments

Hello,

Is there any way to provide allowableValues() for annotation Parameter dynamically (e.g from property file or DB)?

    @Operation(summary = "Retrieve a list of entities")
    @GetMapping
    public List<Entity> get(@Parameter(schema = @Schema(allowableValues = "OneOfThePossibleValuesOfEnum")) EntityTypeEnum entityType) {
...
}

In this example, I would like to have in the documentation, not all values or listed there but being able to populate them from another resource.

vitaliid avatar May 25 '20 15:05 vitaliid

any update for this question please,

ramkumar-equinix avatar Sep 26 '23 11:09 ramkumar-equinix

Did not find a solution yet

vitaliid avatar Sep 26 '23 15:09 vitaliid

Have a look at the ReaderListener interface - you can use an implementation of this interface to modify/customize the OpenAPI instance at runtime

copeg avatar Mar 22 '24 20:03 copeg