Carapacik / swagger_parser

Dart package that takes an OpenApi definition file and generates REST clients based on retrofit and data classes for your project.
https://pub.dev/packages/swagger_parser
MIT License
88 stars 33 forks source link

Query Params are always required, also with required_by_default: false #168

Closed simonmoser-bluesource closed 4 months ago

simonmoser-bluesource commented 4 months ago

This seams to be an issue introduced by adding the option required_by_default. Now all query params are required. Setting required_by_default to false has no effect on query params either.

swagger_parser:
  required_by_default: false
  ...
openapi: 3.0.2
info:
  version: 1.0.0
  title: api
paths:
  /api/v1/items:
    get:
      summary: fetch items
      parameters:
        - name: testparam
          in: query
          schema:
            type: integer
      responses:
        '200':
          description: returns an item
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Item'

components:
  schemas:
    Item:
      type: object
      properties:
        id:
          type: integer
          example: 27