fix: soft fail fallback response description lookups #832
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried fixing this issue in my library as raised in samchungy/fastify-zod-openapi#172
My library dynamically generates
$ref
s for users so they don't need to register anything upfront and plops them into the components section at the end.As an example, my users will fill in the following:
The
transform
hook will output:I tried dynamically injecting the components in the
transform
hook and even when I tried adding components into the fastifySwagger constructor this seems to not work.This function does not seem to reference openapi components:
fastify-swagger/lib/util/resolve-schema-reference.js
Lines 3 to 18 in 36a543c
Additionally this line in particular:
fastify-swagger/lib/util/resolve-schema-reference.js
Line 7 in 36a543c
only returns
schemas
.I might revisit this repo to add proper openapi component support and start incrementally adding components to the
openapiObject
construct but for now I want to unblock my users.Checklist
npm run test
andnpm run benchmark
and the Code of conduct