You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.26.2
Plugin version
8.14.0
Node.js version
20.11.1
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Linux Mint 23.1
Description
When adding shared schemas via fastify.addSchema() for response objects and using the id to access the schema like so: 422: { $ref: 'internalServerErrorResponse#' }, result in a missing description.
Instead of the description displayed from the added schema, you will keep seeing "Default Response". When not using shared ref schemas, but adding the schema to the route schema, the description is taking into account. So it only doesn't work when using ref.
Steps to Reproduce
Add shared schema for a response including a description, like this:
fastify.delete('/:id',{schema: {description: 'Delete an object (example)',response: {422: {$ref: 'validationError#'},},async(req,reply)=>{// ...})
Going to the /docs for swagger, you will see:
Expected Behavior
The description of the schema should be put in the response description as well, instead of showing "Default Response" (which is the fallback description text).
Code
I don't know the codebase, and utils.js is quite complex code. But I suspect to look around there:
I also tried Scalar, I see the same "Default response" message (instead of using the description) when using Scalar api reference interface with $ref responses:
Prerequisites
Fastify version
4.26.2
Plugin version
8.14.0
Node.js version
20.11.1
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Linux Mint 23.1
Description
When adding shared schemas via
fastify.addSchema()
for response objects and using the id to access the schema like so:422: { $ref: 'internalServerErrorResponse#' }
, result in a missing description.Instead of the description displayed from the added schema, you will keep seeing "Default Response". When not using shared ref schemas, but adding the schema to the route schema, the description is taking into account. So it only doesn't work when using ref.
Steps to Reproduce
Using this schema by ID:
Going to the
/docs
for swagger, you will see:Expected Behavior
The description of the schema should be put in the response description as well, instead of showing "Default Response" (which is the fallback description text).
Code
I don't know the codebase, and
utils.js
is quite complex code. But I suspect to look around there:fastify-swagger/lib/spec/openapi/utils.js
Line 342 in fedf75c
The text was updated successfully, but these errors were encountered: