Closed Uzlopak closed 1 year ago
What is the rationale behind this change? This part of fastify-swagger is very widely used
We want to remove swagger-ui from fastify-swagger and create a new plugin fastify-swagger-ui which has the swagger-ui part. see https://github.com/fastify/fastify-swagger-ui/pull/1
So based on that you can have e.g. a fastify-rapidoc impementation where you use fastify-swagger for swagger file generation and rapidoc as openapi viewer.
Makes sense. Then probably we first should release fastify-swagger-ui before this lands?
I am still missing 3 code branches for 100% test coverage.
@kibertoad Thats why I point from initial implementation to this git branch. Also have some deactivated unit tests in fastify-swagger-ui, which have to work again.
We need to document migration path to fastify-swagger-ui somewhere
@fastify/swagger-ui
is out. Could you update this PR, make the CI pass, and add a migration plan?
So! It seems that it is done code wise.
Now regarding the documentation: How should it be done?
I thought of:
Do you agree? Anything that I miss?
Btw. code review is welcome.
Create a Migrate_7_To_8.md (suggestion regarding name welcome)
Could be UPGRADE.md
or MIGRATION.md
I created the migration documentation. So please review it :)
@mcollina PTAL
So when we merge this and release, then we should do the follow up:
It is utmost important to release a new version of @fastify/swagger-ui.
@mcollina
Using now import for top level await.
Rando here who was really confused trying to set this up: @fastify/swagger 8.0 is published but @fasitfy/swagger-ui is not. Any ETA?
@gspetrou I asked @mcollina . He wrote he will do it asap. But it might be tomorrow.
I apologize for the inconvenience.
No problem, impeccable timing on my part! Thanks
@gspetrou It got released 🙏
Thanks for working on this btw @Uzlopak. Never used the UI part in my APIs and it added an extra ~4MB to the build, which for some accounted for 20% of their size!
Great feature, because as you, I was not using swagger-ui.
Until now, I was exposing my dynamic openapi spec via swagger at /documention/json
to use it with rapidoc ui.
But now routePrefix
and exposeRoute
options have been removed, how can I expose my dynamic openapi json spec with fastify-swagger ?
Thx
You'll need to define the routes yourself:
https://github.com/fastify/fastify-swagger-ui/blob/master/lib/routes.js#L95-L115
routePrefix
Hi, I can use fastify-swagger with fastify-swagger-ui now, and I also can use RapicDoc to get the json. But I have the same question, how to expose my dynamic openapi json without fastify-swagger-ui. I try to read routes.js, but still have no idea. Could you give me some hits?
Please open a new detailed issue to be useful for others
Spoiler: fastify.swagger()
Checklist
npm run test
andnpm run benchmark