BRIKEV / express-jsdoc-swagger

Swagger OpenAPI 3.x generator
https://brikev.github.io/express-jsdoc-swagger-docs/#/
MIT License
218 stars 30 forks source link

[BUG] enum does not support integer type #257

Open JustSamuel opened 10 months ago

JustSamuel commented 10 months ago

Describe the bug When defining the spec for an integer enum the resulting swagger will parse the enum values as strings, even if the type is integer or number.

To Reproduce

/**
 * GET /api/v1
 * @summary This is the summary of the endpoint
 * @param {integer} state.query.required - name param description - enum:1,2,3
 * @return {string} 200 - success response
 */

Creates:

type: integer
enum:
  - '1'
  - '2'
  - '3'
  - '4'

Expected behavior Either give an error, or create the following correct swagger:

type: integer
enum:
  - 1
  - 2
  - 3
  - 4

Desktop: