I am having some issues with swagger: I have an array of objects (address) described in this way in the .yaml file:
Address:
properties:
street:
type
To send JSON data, you need to use use an in: body
parameter (not in: formData
) and specify that the operation consumes application/json
. formData
parameters are used for operations that consume application/x-www-form-urlencoded
or multipart/form-data
.
paths:
/something:
post:
consumes:
- application/json
parameters:
- in: body
name: addresses
required: true
schema:
type: array
items:
$ref: "#/definitions/Address" # if "Address" is in the same file
# or
# $ref: "anotherfile.yaml#/definitions/Address" # if "Address" is in another file