Peppe
Peppe

Reputation: 314

swagger - array of object in paths not allowed

is it possible to have an array of complex object inside the get parameters? If I try this code, I get a parameter definition error due to this line: $refs: '#/definitions/pax'

swagger: '2.0'
info:
version: 0.0.0
title: Simple API
paths:
 /:
    get:
      parameters:
        - name: passengers
          in: query
          type: array
          items:
             $refs: '#/definitions/pax'

    responses:
      200:
        description: TODO

definitions:
  pax:
    type: object
    properties:
      name:
        type: string
      familyname:
        type: string

Upvotes: 1

Views: 1022

Answers (1)

William Cheng
William Cheng

Reputation: 10797

For request parameters, only body parameter can be defined with an Object (model).

You will need to provide an example of the URL query string so that we can help you define it with Swagger/OpenAPI spec.

Upvotes: 2

Related Questions