Ask a Question

Swagger creating the query parameters: products[i][sku]

SOLVED
Dzmitry
New Member

Swagger creating the query parameters: products[i][sku]

Hello!

Somebody knows how to create the filed: products[i][sku] in swagger. I have example but it does not works. It must be like the example: /v1/api/getShippingPrices?products[i][sku]=&products[i][quantity]=> 

now I have this:

 

/getShippingPrices:
get:
tags:
- countries_shipping
summary: searches inventory
operationId: getShippingPrices
description: Feature that enables you to cancel a previously placed order, as long as it is yet to be processed
parameters:
- in: query
name: address
required: true
schema:
type: array
items:
$ref: '#/components/schemas/Address'
- in: query
name: products2
required: true
schema:
type: array
items:
$ref: '#/components/schemas/Products'

 

but it returned the URL: 

 

https://apidev.btswholesaler.com/v1/api/getShippingPrices?address={
"country_code": "HR",
"postal_code": "20100"
}&products={
"sku": "4005808801039",
"quantity": 4
}

it is not like the example above.

1 REPLY 1
HKosova
SmartBear Alumni (Retired)

Hi @Dzmitry,

OpenAPI Specification currently does not provide a way to serialize nested objects and arrays of objects as param[a][b][c]-style query parameters. Here's the corresponding enhancement request you can track:

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

 


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: