cancel
Showing results for 
Search instead for 
Did you mean: 

Can I change swagger's separation delimiters for pipe query params ?

Highlighted
New Contributor

Can I change swagger's separation delimiters for pipe query params ?

Hi 

 

I'm trying to define an early rest, pre-crud api in swagger. 

The syntax looks like this: 

 

PUT /MyContainer/MyDataObject.txt?metadata:colour;metadata:shape;metadata:size

 

I'd like to change the equal sign '=' to a colon ':' and the ampersand '&'  to a semicolon ';'. 

Is this possible  ?   

 

An alternative would be having a default query parameter without requiring a tag in the uri.

 

cheers

 

2 REPLIES 2
Highlighted
Moderator

Re: Can I change swagger's separation delimiters for pipe query params ?

Hi @garymazz,

 

OpenAPI Specification only supports query strings that use name=value parameters. Since your query string does not have the "=" sign, it cannot be described using OpenAPI.

 

There's an existing enhancement request to add support for arbitrary query strings:

https://github.com/OAI/OpenAPI-Specification/issues/1502


Helen Kosova
SmartBear Documentation Team Lead
________________________
Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
New Contributor

Re: Can I change swagger's separation delimiters for pipe query params ?

Hi @HKosova 

 

Thank you for the quick reply. I was suspect swagger couldn't handle non-k=v parameters, but was just checking to confirm.  

 

Interestingly, I indepentedntly went down the same work around path in https://github.com/OAI/OpenAPI-Specification/issues/1502. Its been nearly 2 years since this issue was opened and there seems to be little movement on it.  

 

I would hate to have to move to raml over this one feature (validation via regex), I'll have to write a code genererator for a c++ framework and one for spring boot.

 

However seeing no action was taken on this issue in 2 years, the raml route seems easier (more timely) than changing the OAS specification and code changes to swagger core, doumentation and scaffold generators.

 

Thanks

gary

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors