mona2020
5 years agoNew Contributor
How to pass array of strings in post body?
Hi everyone, I'm trying to get my Swagger UI 3.17.1 POST operation to take a JSON array of strings but am currently getting a runtime error from Symfony/API Platform: "Invalid value provided (invalid IRI?)." I'd appreciate any help on how to get my configuration working. Here is my current YAML configuration:
zooniverse-datasheets:
method: 'POST'
path: '/projects/{id}/zooniverse/datasheets'
controller: 'App\Controller\ZooniverseSendDatasheetsAction'
# read: false
swagger_context:
summary: Send project's datasheet(s) to Zooniverse
parameters:
- in: path
name: id
required: true
type: string
- in: body
name: datasheets
required: false
schema:
type: array
items:
type: string
example: ["ID1", "ID2", "ID3"]
# description: list of datasheet IDs in JSON array format
responses:
'201':
description: 'Success'
'400':
description: 'Invalid input'
'404':
description: 'Resource not found'
and here is a screen shot of the operator so far:
I'm pretty new to Swagger but have gotten other operators to work but having trouble with this one. Any help is greatly appreciated!
thanks,
Mona