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

ApiModelProperty doesn't support example for arrays / Lists

Open m-radzikowski opened this issue 10 years ago • 49 comments

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.

m-radzikowski avatar Jul 19 '16 08:07 m-radzikowski

+1

kellerassel007 avatar Dec 01 '16 16:12 kellerassel007

+1

smalik2043 avatar Jan 27 '17 11:01 smalik2043

+1

nandana avatar Jan 31 '17 17:01 nandana

+1

Satyricon avatar Feb 02 '17 10:02 Satyricon

+1

QuasiSoDo avatar Feb 02 '17 14:02 QuasiSoDo

It looks like a lot of people are looking for this feature. This is great. If anyone wants to try and submit a PR to add the functionality, that would be appreciated.

webron avatar Feb 02 '17 19:02 webron

+1

SIDSSIDS avatar Feb 03 '17 08:02 SIDSSIDS

+1

mcicu avatar Feb 03 '17 15:02 mcicu

+1

ghost avatar Feb 14 '17 09:02 ghost

+1

qwert321 avatar Feb 23 '17 04:02 qwert321

+1

yana2301 avatar Mar 03 '17 12:03 yana2301

+1

timstegeman2 avatar Mar 03 '17 13:03 timstegeman2

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

fehguy avatar Mar 03 '17 16:03 fehguy

+1

chad-levesque avatar Jun 22 '17 14:06 chad-levesque

+1 : it's quite bothering since arrays are pretty common in REST API...

kusan-reveur avatar Jun 27 '17 14:06 kusan-reveur

+1

modulo- avatar Jun 27 '17 14:06 modulo-

+1

jonherrmann avatar Jun 27 '17 18:06 jonherrmann

Will be supported in 3.0.0 support, please see the feature/3.0.0-rc2 branch for details.

fehguy avatar Jun 27 '17 18:06 fehguy

+1

sarojkv avatar Aug 08 '17 17:08 sarojkv

When is the release due for this version?

sarojkv avatar Aug 09 '17 08:08 sarojkv