Feature request: @ApiModelProperty example support number type
See original GitHub issueI’d like to request a feature which will allow example field of ApiModelProperty support number type.
For latest release version (1.5.0), if you use example like this:
        @ApiModelProperty(dataType = "double", required = true, example = "1234")
    private Double numberField;
The generated swagger spec looks like:
 "numberField" : {
          "type" : "number",
          "format" : "double",
          "example" : "1349"
        }
Which I believe should be:
 "numberField" : {
          "type" : "number",
          "format" : "double",
          "example" : 1349
        }
Issue Analytics
- State:
 - Created 8 years ago
 - Comments:13 (5 by maintainers)
 
Top Results From Across the Web
swagger @ApiModelProperty example value for List<String ...
I managed to get this to work, generating a List of Strings. Within the ApiModelProperty with springfox 2, write your example as follows:...
Read more >ApiModelProperty (swagger-annotations 1.5.0 API)
Allows a model property to be hidden in the Swagger model definition. ... Specifies a reference to the corresponding type definition, overrides any...
Read more >Guide - 7.10.12.2 Migrating to OpenApi 3.0 and Swagger 2.X ...
Examples for Operations ... Only if the decorated getter is not an array type. ... @APIModelProperty(readOnly = true), @Schema(accessMode=AccessMode.
Read more >Swagger - elide.io
Prune Fields - All GET requests support JSON-API sparse fields query parameter ... example and value fields are extracted from ApiModelProperty annotations.
Read more >Top 5 class-validator Code Examples - Snyk
To help you get started, we've selected a few class-validator examples, ... 0) { // return BAD REQUEST status code and errors array...
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

@etyrrill Can you explain how you used Property.example to format the @ApiModelProperty example value? I have the annotation on the property of the class.
class ClassName { @ApiModelProperty(name = "name", value = "value", example = "[\"v1\", \"v2\"]") private List<String> values; }Now what do I have to do with Property.class and Property.example ?I think this is a similar issue:
gives me
but I’d like