fastify-swagger icon indicating copy to clipboard operation
fastify-swagger copied to clipboard

Remove swagger-ui

Open Uzlopak opened this issue 3 years ago • 6 comments
trafficstars

Checklist

Uzlopak avatar Sep 30 '22 10:09 Uzlopak

What is the rationale behind this change? This part of fastify-swagger is very widely used

kibertoad avatar Sep 30 '22 10:09 kibertoad

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.

Uzlopak avatar Sep 30 '22 10:09 Uzlopak

Makes sense. Then probably we first should release fastify-swagger-ui before this lands?

kibertoad avatar Sep 30 '22 11:09 kibertoad

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.

Uzlopak avatar Sep 30 '22 13:09 Uzlopak

We need to document migration path to fastify-swagger-ui somewhere

kibertoad avatar Oct 01 '22 08:10 kibertoad

@fastify/swagger-ui is out. Could you update this PR, make the CI pass, and add a migration plan?

mcollina avatar Oct 02 '22 11:10 mcollina

So! It seems that it is done code wise.

Now regarding the documentation: How should it be done?

I thought of:

  • [x] Create a Migrate_7_To_8.md (suggestion regarding name welcome)
  • [x] Short Section in readme.md regarding integration with @fastify/swagger-ui, reference to the migration.md

Do you agree? Anything that I miss?

Btw. code review is welcome.

Uzlopak avatar Oct 05 '22 13:10 Uzlopak

Create a Migrate_7_To_8.md (suggestion regarding name welcome)

Could be UPGRADE.md or MIGRATION.md

kibertoad avatar Oct 05 '22 14:10 kibertoad

I created the migration documentation. So please review it :)

Uzlopak avatar Oct 07 '22 02:10 Uzlopak

@mcollina PTAL

Uzlopak avatar Oct 10 '22 08:10 Uzlopak

So when we merge this and release, then we should do the follow up:

  1. Publish @fastify/swagger as 8.0.0
  2. merge https://github.com/fastify/fastify-swagger-ui/pull/6
  3. Publish @fastify/swagger-ui

It is utmost important to release a new version of @fastify/swagger-ui.

Uzlopak avatar Oct 10 '22 09:10 Uzlopak

@mcollina

Using now import for top level await.

Uzlopak avatar Oct 10 '22 10:10 Uzlopak

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 avatar Oct 10 '22 18:10 gspetrou

@gspetrou I asked @mcollina . He wrote he will do it asap. But it might be tomorrow.

I apologize for the inconvenience.

Uzlopak avatar Oct 10 '22 19:10 Uzlopak

No problem, impeccable timing on my part! Thanks

gspetrou avatar Oct 10 '22 19:10 gspetrou

@gspetrou It got released 🙏

Uzlopak avatar Oct 10 '22 20:10 Uzlopak

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!

Fdawgs avatar Oct 18 '22 09:10 Fdawgs

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

https://github.com/fastify/fastify-swagger/pull/672/files#diff-7aa4473ede4abd9ec099e87fec67fd57afafaf39e05d493ab4533acc38547eb8L62-L71

briceruzand avatar Oct 26 '22 14:10 briceruzand

You'll need to define the routes yourself:

https://github.com/fastify/fastify-swagger-ui/blob/master/lib/routes.js#L95-L115

mcollina avatar Oct 26 '22 14:10 mcollina

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?

dennys avatar Sep 28 '23 17:09 dennys

Please open a new detailed issue to be useful for others

Spoiler: fastify.swagger()

Eomm avatar Sep 28 '23 19:09 Eomm