Swagger ui and complex types

hi, I’m having problems having the swagger ui working with complex types.
Using the json sstack client it works and fiddler shows this:
GET http://localhost:62795/complexType?complexType={aBool%3ATrue%2CaString%3Apippo} HTTP/1.1
Accept: application/json

when using the swager ui I type { aBool : true , aString : “W” }
and what is sent is
GET http://localhost:62795/complexType?complexType={%20%20aBool%20%3A%20true%20%2C%20aString%20%3A%20"W"%20} HTTP/1.1
Accept: application/json

In this case the 2 properties aBool and aString are not captured

What is the problem with the swagger ui ? why does it set up a query string like this ?

thank you

enrico

Well … I read the docs sbout jsv … it seems that white are significant … sending this
{aBool:true,AString:hello}
it does work

However note that the json shown in the datatype column is misleading, since it shows json and not jsv

Swagger UI doesn’t know about JSV (or is likely to ever add support for it) and sending JSON on the query string is a really bad idea, it’s tolerable with JSV since it’s white-space significant so typically doesn’t require quotes or spaces.

But I’m not seeing where you’re getting the JSV from, what’s adding the spaces or are you manually creating it?

yes, the point is about how I have to “type” the complex type in the swagger ui (a textbox).
It works if I type jsv … not if I type json

Using the service stack rest client and letting him doing the serialization of the type,…: it does serialiize it in jsv on the query string … and it does work.

Enrico

JSON is never meant to go on the QueryString. Swagger UI doesn’t support it because most API’s don’t support specifying complex types on the QueryString which ideally should flat key value pairs so they’re interoperable with all HTTP clients.

ServiceStack is unique in letting you use JSV for specifying complex types on the queryString as it’s tolerable to construct by hand.