Open gorbster opened 8 months ago
Hey @gorbster, OpenAPI specification suggests that when the object is used for query parameters, by default the value of it's properties should be at top level.
Ref: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#style-examples
For detailed explanation, for query, parameters called style
and explode
which determines how value of query will be handled are defaulted to form
and true
. And for these values, you can see from table that top level param name is not maintained and individual params will be formed for each key value pairs.
To keep top level param intact, you can mention explode
as false
in you definition. i.e. below will provide you result with location
intact.
{
"schema":
{
"type": "object",
"properties":
{
"zip":
{
"type": "string",
"description": "Your zip code",
"maxLength": 5,
"minLength": 5
},
"address":
{
"type": "string",
"description": "Your address"
}
}
},
"in": "query",
"name": "location",
"required": true,
"explode": false
}
The OpenAPI 3 spec allows for query parameters that are of type object. However when this is converted to a Postman collection, the parameters are converted to key / value string pairs. The below example is from an OpenAPI spec that defines a request with a GET query param of type object (
location
) that must include oneOf the listed properties (zip
oraddress
). When converted to a Postman collection,zip
is created as a top-level parameter instead of a nested parameter within thelocation
object.