-
-
Notifications
You must be signed in to change notification settings - Fork 213
Closed
Labels
feature requestNew feature to be addedNew feature to be added
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
5.3.3
Plugin version
9.5.1
Node.js version
22.15.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Ubuntu 24.04
Description
The OpenAPI spec supports the type of parameters as const as of 3.1.0. However, this library converts const definitions to single-value enums, right here
fastify-swagger/lib/spec/openapi/utils.js
Line 537 in 20ab71c
| openapiSchema.enum = [openapiSchema.const] |
It should only do that for OpenAPI 3.0.x
Link to code that reproduces the bug
https://github.com/TastyPi/fastify-issue
Expected Behavior
The printed OpenAPI spec should have "const": "1" for the header, instead it has "enum": ["1"].
Metadata
Metadata
Assignees
Labels
feature requestNew feature to be addedNew feature to be added