"null value support" for query parameter in swagger-ui ?

3,557 views
Skip to first unread message

Rick Sun

unread,
Jan 29, 2016, 11:12:51 AM1/29/16
to Swagger
Looks like all related tickets to https://github.com/OAI/OpenAPI-Specification/issues/229 were closed about a month ago. Just wonder if swagger-ui supports query parameter without value now? If yes, what is the syntax? I tried adding {"x-nullable" : true} to the query parameter definition, no use. Thanks for any info.

Ron Ratovsky

unread,
Jan 29, 2016, 11:15:40 AM1/29/16
to swagger-sw...@googlegroups.com
Query parameters with no value can be down with allowEmptyValue. ‘null’ is not an empty value.

--
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.

Rick Sun

unread,
Jan 29, 2016, 11:55:31 AM1/29/16
to Swagger
Ron, thanks for the answer. 
My URL needs be something like "http://127.0.0.1/api?param" where "param" is a parameter without value. This is not possible with the current swagger-ui because a value is always expected. So I am using "http://127.0.0.1/api?param=true" as a workaround using this definition:
{
        in: "query",
        name: "param",
        type: "string",
        required: false,
        enum : ["true"]
};

I tried "allowEmptyValue" : true or "x-nullable" : true, or type : "null", none of these make any difference (type: "null" is not accepted). Ideally, what needed is a checkbox in swagger-ui for the parameter: when checked, just send "?param" without any value. Is this possible now?

"empty value" probably means "?param=". "null value" probably means "?param" without "=". These terms may mean different things, but I am only looking for "?param" without = sign.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

Ron Ratovsky

unread,
Jan 29, 2016, 12:07:31 PM1/29/16
to swagger-sw...@googlegroups.com
A null value would be ?param=null, not ?param.

x-nullable I not supported in the ui as it’s not part of the spec. If allowEmptyValue isn’t supported, I’d suggest opening a ticket about it.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

Rick Sun

unread,
Jan 29, 2016, 5:01:38 PM1/29/16
to Swagger
Ron, thanks. Just opened "allowEmptyValue not implemented? #1934".
Probably it is supported, but I do not have the correct setting for it, so I put a question mark.
Reply all
Reply to author
Forward
0 new messages