Query parameters with object and arrays
Hi there, We all know that we can pass object and array parameters using queries according to OAS 3.0. There are different ways to organize the way those queries appear in the URL, with style and explode keywords. I need to know: Is it common in the industry to use query parameters with arrays and objects? If so, what is the most common style and explode method? thank you
From what i have seen the usage of array is quite limited, and even more the usage of object
a common use case is about selecting a list of fields
typicial use case about having an array is arround "search" , is about a 'projection' , where you select the list of field that need to be displayed
like doing get /cars?fields=model,color that will renturn only the 2 fields even if a car has many other fields
this is commented here https://medium.com/@mwaysolutions/10-best-practices-for-better-restful-api-33a25a4e92c1
this is also a pattern that you can find in OData with the keyword select for instance GET serviceRoot/Airports?$select=Name, IcaoCode
notice than OData is still quite hard to represent using OAS , but it get less and less popular
another common use case very similar is when you do reporting of a csv file here you would put the list of column for instance
last use case is about mutli value parameters for instance when you have an enum
GET /cars?color=blue,green
most of the case i ve seen is using array with coma separated.
Notice i do not have fact , it is not a scientific study.
No further replies since the answer a couple of months ago, closing.
(BTW, there are public hubs / repositories of OpenAPI descriptions, so you might want to look through those - I don't know where they are, I just know they exist out there).