question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ApiModelProperty doesn't support example for arrays / Lists

See original GitHub issue

By default array or List of integers is generated in UI with example:

"eventTypes": [0],

I’ve tried to add “example” property, but that:

@ApiModelProperty(required = true, example = "[2, 3]")
private int[] lorem;

generates example values as string:

"eventTypes": "[2, 3]",

Other options like "2, 3" don’t work neither. In result to have valid json in example it has to have only one value, zero.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:52
  • Comments:48 (4 by maintainers)

github_iconTop GitHub Comments

13reactions
justforadblockcommented, Dec 4, 2017

image

it’s work

13reactions
fehguycommented, Mar 3, 2017

This takes a major refactoring of the models, which is on the way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

swagger @ApiModelProperty example value for List<String ...
So in conclusion, support for examples for arrays/Lists has been worked on and should be available in ... This seems to not be...
Read more >
Specify an Array of Strings as Body Parameters in Swagger
In this tutorial, we'll show how to produce a default example value for String arrays, as this behavior is not enabled by default....
Read more >
ApiModelProperty (swagger-annotations 1.6.9 API)
Allows a model property to be hidden in the Swagger model definition. ... Specifies if the parameter is required or not.
Read more >
Spring Boot + Swagger2- Understanding various Swagger ...
Various Swagger annotations are available to help document the REST APIs. ... Since this is displayed in the list of operations in Swagger-UI...
Read more >
ApiModelProperty (swagger-annotations 1.6.2 API) - javadoc.io
There are three ways to describe the allowable values: To set a list of values, provide a comma-separated list. For example: first, second,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found