express-openapi icon indicating copy to clipboard operation
express-openapi copied to clipboard

Support default values in query params

Open AustinGil opened this issue 4 years ago • 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?

AustinGil avatar Apr 23 '21 16:04 AustinGil

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

wesleytodd avatar Aug 25 '23 17:08 wesleytodd