Open melroy89 opened 4 months ago
Thanks for reporting!
Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.
Owh, I thought I gave already some code snippets in the reproducible section above.
I will make a new GitHub repo in that case, if really needed.
Here you go a reproducible example: https://github.com/melroy89/fastify-shared-schema-issue. I can't make it easier for you 😆
The bug is only present in OpenAPI v2 it seems (in @fastify/swagger/lib/spec/swagger/utils.js
). When using OpenAPI v3 specification in Swagger (which is NOT the default), the error described above does no longer appear. Meaning the problem is only in v2 aka 'Swagger' API.
Won't fix. No time.
No problem!
But no need to close the issue if the issue still exists
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 going to the documentation page (Swagger), I get:
Steps to Reproduce
Code/repo: https://github.com/melroy89/fastify-shared-schema-issue
My shared schema, I add during start-up:
Using the JSON schema in Fastify with the shared schema reference from above:
Ps. I also want to keep it extensible, so if a specific API end point needs additional querystrings I should be able to do:
Expected Behavior
No errors :). I think my shared schema is correct and should just work.