I'm developing a web service with OpenAPI 3.0.0. Basically, I want to create an endpoint which does some magic when I send an HTTP POST request there.
The problem is that I need to pass some params in a URL query string in a form of http://example.com/create?custom_extras[0][name]=Bob&custom_extras[0][price_id]=1&custom_extras[0][duration]=0
.
To be more precise I have a problem with custom_extras[0][name]=Bob&custom_extras[0][price_id]=1&custom_extras[0][duration]=0
. As a matter of fact I need here an array of objects.
Example:
[
{
"name": "Bob",
"price_id": 42,
"duration": 0
},
{
"name": "Sam",
"price_id": 43,
"duration": 0
}
]
I've created a specification with swagger which gives me http://example.com/creata?custom_extras[0]={"name": "Bob", "price_id": 42, "duration": 0}"&custom_extras[1]={"name": "Sam", "price_id": 43, "duration": 0}"
However, what I really want is to have something similar to this http://example.com/creata?custom_extras[0][name]=Bob&custom_extras[0][price_id]=42&custom_extras[0][duration]=0&custom_extras[1][name]=Sam&custom_extras[1][price_id]=43&custom_extras[1][duration]=0
I was wondering if it is possible to create the URL of the form I described above? Thanks.
Here is swagger I used.
openapi: "3.0.0"
info:
description: "Example"
version: "1.0.0"
title: "Example"
paths:
/create:
post:
tags:
- example
summary: Example
parameters:
- in: query
name: custom_extras
required: false
style: deepObject
explode: true
schema:
type: array
items:
type: object
additionalProperties:
type: object
properties:
name:
type: string
price_id:
type: integer
duration:
type: integer
responses:
200:
description: OK