How to "Provide multiple values in new lines"

896 views
Skip to first unread message

mail.ta...@gmail.com

unread,
Sep 18, 2016, 9:50:24 AM9/18/16
to Swagger
Hi!

I am fairly new to swagger UI and having a problem using it.

Everything works find except when I try to do this.



I tried every possible input for the hashtags list but nothing works with the following error.

{ "timestamp": 1474206473958, "status": 400, "error": "Bad Request", "exception": "org.springframework.validation.BindException", "errors": [ { "codes": [ "typeMismatch.postCreationRequest.hashtags", "typeMismatch.hashtags", "typeMismatch.java.util.List", "typeMismatch" ], "arguments": [ { "codes": [ "postCreationRequest.hashtags", "hashtags" ], "arguments": null, "defaultMessage": "hashtags", "code": "hashtags" } ], "defaultMessage": "Failed to convert property value of type [java.lang.String[]] to required type [java.util.List] for property 'hashtags'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Map] for property 'hashtags[0]': no matching editors or conversion strategy found", "objectName": "postCreationRequest", "field": "hashtags", "rejectedValue": "tag,tag,tag", "bindingFailure": true, "code": "typeMismatch" } ], "message": "Validation failed for object='postCreationRequest'. Error count: 1", "path": "/createOfficialPost" }

If I do not provide anything is the hashtags field, everything works fine.

the model schema looks like this
{ "date": "string", "hashtags": [ {} ], "id": 0, "image": { "id": 0, "s3_key": "string", "url": "string" }, "landmark": "string", "lat": 0, "likes": 0, "lng": 0, "message": "string", "official": true, "privacy": true, "radius_in_km": 0, "username": "string" }

In what way should I write there to make it work? 

This is my API endpoint:
        public Post submit(HttpServletRequest request,
@ModelAttribute Post post,
@RequestPart("image") MultipartFile image) {



mail.ta...@gmail.com

unread,
Sep 18, 2016, 9:56:08 AM9/18/16
to Swagger
private List<Map<String, Object>> hashtags; 
I am trying to set it here. 

tony tam

unread,
Sep 18, 2016, 5:32:12 PM9/18/16
to swagger-sw...@googlegroups.com
Looks like a SpringMVC integration issue.  You may want to just clone the sample from here:


And make changes to that to figure out what you have set up incorrectly.

On Sep 18, 2016, at 6:56 AM, mail.ta...@gmail.com wrote:

private List<Map<String, Object>> hashtags; 
I am trying to set it here. 

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages