wesleytodd/express-openapi

Support default values in query params

AustinGil opened this issue · 1 comments

The Swagger specification points out that you can set default values for parameters (https://swagger.io/docs/specification/describing-parameters/#default).

I tried adding some to my route definition, but it doesn't seem to do anything. Here's what mine looks like:

openapi.validPath({
    // ...
    parameters: [
      {
        in: 'query',
        name: 'perPage',
        schema: { type: 'integer', default: 24 },
      },
    ],
    // ...
})

Does the library support default values?

I don't think it does support them, but I would accept a PR for that for sure.