i have a question about how to define an array of refs in swagger using the yaml syntax. I have the following yaml snippet which defines my field:
- name: myfield
in: formData
description: 'description'
required: false
type: array
items:
$ref: '#/definitions/MyRef'
The definition is the following:
MyRef:
type: object
properties:
id:
type: integer
value:
type: string
description: the value for the myRef
In the preview of my field everything looks fine:
But I got the error "Not a valid parameter definition" and in the detailed error I got "Data does not match any schemas from 'oneOf'".
I can't find anything like this in the documentation. So what's the correct structure or what am I missing?
that's because formData
may only contain primitives or arrays of primitives. You cannot use a $ref
as the items
value. This will be changed in the next version of the spec (3.0) but it is not supported in the 2.0 tooling because the spec does not allow it.