ApiModelProperty doesn't seem to support List and allowableValues
See original GitHub issueI have the following annotation in my model
@ApiModelProperty(value = "A list of items", allowableValues = "item1, item2, item3")
private List<String> itemList;
the swagger.json generated is as follows.
"itemList" : {
"type" : "array",
"description" : "A list of items",
"items" : {
"type" : "string"
}
}
allowableValues
are missing from the swagger.json
.
Also is array the correct output type for a List<String>
?
My config
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.4</version>
</dependency>
<plugins>
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>swagger</id>
<phase>compile</phase>
<goals>
<goal>generate</goal>
</goals>
...
</execution>
</executions>
</plugin>
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Java swagger-ui doesn't render allowableValues for parameter
I have a SpringBoot, JAX-RS, and Maven app. I'm using Swagger annotations to provide info on the REST service interface. It basically works,...
Read more >ApiModelProperty (swagger-annotations 1.5.0 API)
Limits the acceptable values for this parameter. There are three ways to describe the allowable values: To set a list of values, provide...
Read more >springfox/springfox - Gitter
How can I use @ApiModelProperty to create an example value of null? This does not compile: @ApiModelProperty(example = null) public Long nullableField;.
Read more >allowableValues from Enum.values()? - Google Groups
Is it possible to provide the allowableValues value from an enum using something like MyEnum.values()? It doesn't seem possible.
Read more >docs/release-notes.md · serv/springfox - Gitee.com
... swagger-ui.html appears to be empty documentation @silentsnooc; (#2090) When using AlternateTypeRuleConvention ApiModelProperty annotation does not work ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is this issue closed because it should work already or because it won’t be fixed?
I have a similar problem. My object has a list of enum values, but I want to restrict the values which may be used by the API.
This works:
This doesn’t work (it ignores the allowableValues and uses all possible enum values instead):
Yeah, at the moment
allowableValues
would work for primitives or ranges. The workaround for this would be to use a list of enum instead and the allowableValues would be derived from it.