-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using $ref in array query parameter #1145
Comments
You cannot use $ref's in any way under non-body parameters, not directly and not for arrays. You'd have to define it all inline. This changes in the next version of the spec. |
Hi, i have simmilar issue; i try describe this form <form>
<input name="contact[0][name]" />
<input name="contact[0][number]" />
<input name="contact[1][name]" />
<input name="contact[1][number]" />
...
<input name="contact[n][name]" />
<input name="contact[n][number]" />
</form> swagger: '2.0'
info:
title: Test case
description: Complex form data
version: 1.0.0
host: test.example.com
schemes:
- http
basePath: /v1
produces:
- application/json
paths:
/test:
post:
summary: Example
description: |
Example
parameters:
- name: items
in: formData
description: Array of strings
type: array
items:
type: string
- name: contacts
in: formData
description: Array of objects which won't work
type: array
items:
properties:
example_id:
type: string
description: Unique identifier
description:
type: string
description: Description of example.
responses:
default:
description: Some response
schema:
$ref: '#/definitions/Example'
definitions:
Examples:
type: array
items:
$ref: '#/definitions/Example'
Example:
type: object
properties:
example_id:
type: string
description: Unique identifier
description:
type: string
description: Description of example. Can you help me with this? Can i describe array of objects in form data request in current version of swagger? |
@gjorgic - today, you'd need to declare those explicitly. So you'd need to create a parameter with the name |
I wonder; Is there a reason for not allowing |
Swagger File
Issue
Given the file above, I get the following error:
If I replace
with plain
then the error goes away. Judging by Response Object Examples in the spec (not the same, but related), it should be okay to use
$ref
in this context. Is my assumption wrong, or is this a bug?The text was updated successfully, but these errors were encountered: