mrin9 / RapiPdf

PDF generation from OpenAPI / Swagger Spec
https://mrin9.github.io/RapiPdf
MIT License
282 stars 102 forks source link

Using content to define serialization is not supported in query #104

Open ocimer opened 2 years ago

ocimer commented 2 years ago

A complex query parameter that uses content to define serialization is not supported. See "Parameter object" in Swagger docs.

When trying to generate PDF from YAML below it fails. There are no logs that would report the failure, which is disappointing.

openapi: 3.0.0

info:
  version: 0.1.0
  title: "My API. (Test)"
servers:
  - url: "http://example.com/my-api"
    description: "My server"

paths:
  /locations:
    get:
      summary: List of locations
      description: "Return a list of all locations the user has access to."
      operationId: listLocations
      security:
        - tokenJWT: []
      parameters:
        - $ref: "#/components/parameters/FilterParam"
      tags:
        - Locations
      responses:
        "200":
          description: "A list of locations."
        "401":
          description: "Unauthorized."

components:
  parameters:
    FilterParam:
      name: filter
      in: query
      required: false
      description: "Filter as a JSON object."
      content:
        application/json:
          schema:
            type: object
            required:
              - name
            properties:
              id:
                type: integer
              name:
                type: string

Removing content and application/json from FilterParam solves the issue.

components:
  parameters:
    FilterParam:
      name: filter
      in: query
      required: false
      description: "Filter as a JSON object."
      schema:
        type: object
        required:
          - name
        properties:
          id:
            type: integer
          name:
            type: string