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 was formerly using swagger-jsdoc to generate OpenAPI spec for an Express API.
We are moving on Fastify and fastify-swagger seems very well integrated in the fastify ecosystem, then I tried removing swagger-jsdoc in favor of fastify-swagger.
This permit to override the property data of the referenced schema PaginatedDto with another ref named PurchaseItemDto.
Here is the result of this allOf schema:
FYI here is the initial PaginatedDto schema object:
I "translated" the same thing on a schema used in fastify-swagger like this piece of code:
I tried the exactly same object also, with content and schema keys
This result in the serialization error when starting the fastify app
FastifyError [Error]: Failed building the serialization schema for GET: /api/purchases, due to error Failed to merge "type" keyword schemas.
at Boot.<anonymous> (/Users/mac/Documents/Projects/bff-next-gen/node_modules/.pnpm/[email protected]/node_modules/fastify/lib/route.js:401:21)
at Object.onceWrapper (node:events:633:28)
at Boot.emit (node:events:531:35)
at /Users/mac/Documents/Projects/bff-next-gen/node_modules/.pnpm/[email protected]/node_modules/avvio/boot.js:102:12
at /Users/mac/Documents/Projects/bff-next-gen/node_modules/.pnpm/[email protected]/node_modules/avvio/boot.js:437:7
at done (/Users/mac/Documents/Projects/bff-next-gen/node_modules/.pnpm/[email protected]/node_modules/avvio/lib/plugin.js:228:5)
at check (/Users/mac/Documents/Projects/bff-next-gen/node_modules/.pnpm/[email protected]/node_modules/avvio/lib/plugin.js:252:9)
at node:internal/process/task_queues:151:7
at AsyncResource.runInAsyncScope (node:async_hooks:211:14)
at AsyncResource.runMicrotask (node:internal/process/task_queues:148:8) {
code: 'FST_ERR_SCH_SERIALIZATION_BUILD',
statusCode: 500
}
I don't know if the allOf usage I do is valid or not but the OpenAPI doc seems to allowing this.
I don't know if this is a bug of the fastify swagger serializer or if I missed something on my spec.
Is someone already did that? I a fastify swagger bug or not?
Thanks for helping 😄
Your Environment
node version: >22
fastify version: >=5.1.0
fastify swagger version": >=9.4.0
os: Mac
OpenAPI spec version: 3.1.0
The text was updated successfully, but these errors were encountered:
You have already researched for similar issues?
This issue seems related #1053
💬 Question here
I was formerly using swagger-jsdoc to generate OpenAPI spec for an Express API.
We are moving on Fastify and fastify-swagger seems very well integrated in the fastify ecosystem, then I tried removing swagger-jsdoc in favor of fastify-swagger.
With JSdoc I was doing this:
This permit to override the property
data
of the referenced schemaPaginatedDto
with another ref namedPurchaseItemDto
.Here is the result of this
allOf
schema:FYI here is the initial
PaginatedDto
schema object:I "translated" the same thing on a schema used in fastify-swagger like this piece of code:
This result in the serialization error when starting the fastify app
I don't know if the allOf usage I do is valid or not but the OpenAPI doc seems to allowing this.
I don't know if this is a bug of the fastify swagger serializer or if I missed something on my spec.
Is someone already did that? I a fastify swagger bug or not?
Thanks for helping 😄
Your Environment
>22
>=5.1.0
>=9.4.0
Mac
3.1.0
The text was updated successfully, but these errors were encountered: