swagger-api / swagger-api/swagger-core
Question: Is there a way to specify allowableValues dynamically?
Open
Nobody has claimed this yet.
backlog
- Dominant language
- Java
- Stars
- 7.5k
- Forks
- 2.3k
- Avg merge
- 18h 1m
- Merged PRs (30d)
- 10
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the @Parameter and @Schema annotations and the OpenAPI generation path mentioned in the issue. Determine whether allowable values can be sourced dynamically from a property file or database, and define the supported behavior and documentation outcome.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100