pb33f/libopenapi-validator

Handling of default values in query parameters

emilien-puget opened this issue · 4 comments

First of all, i love what you did there.

What do you think about handling default values in query parameters ?

Could you help me understand a little more?

in a open api specification, a default value can be specified like so

      name: "page"
      in: "query"
      style: "deepObject"
      required: false
      schema:
        type: object
        properties:
          size:
            type: integer
            minimum: 1
            maximum: 50
            default: 20
            require: false

Right now we would reject an http query with size not set because it violates the schema, but a default value is set.

Oh, yes! of course. I forgot about that. We should absolutely add support to the validators.

after some deliberation, i think we should not do that, as this suggestion would mean that we modify the request, and we should keep the responsibility of this library to validate request