-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scalar OpenAPI Docs Integration #1858
Scalar OpenAPI Docs Integration #1858
Conversation
ac64fca
to
3b03181
Compare
I wonder if rather than shifting the default from |
@mikaelkaron I like your idea of making it configurable! where the user can choose:
im guessing we can keep the configuration inside of |
Yeah, and perhaps the name could even be an npm package? How different is this than just using @mcollina - would it be possible to have the UI be part of a generator rather than just bundled and have the user able to switch? |
Btw, the same would probably be true for |
030d383
to
841465d
Compare
A few notes:
I really like the new UI. @mikaelkaron would you prefer the old school UI? If so, why? I think we could make it configurable somehow / part of the generator. |
d524661
to
d82e0a6
Compare
New and updated dependencies detected. Learn more about Socket for GitHub βοΈ
|
@mcollina Glad you like the new UI β¨ I just pushed up a fix for DCO & also exposing the swagger spec download to the old route. I think if the preference is the old school UI, we are going to have a configuration where users can choose "modern" or "classic" layout. Hopefully shipped in the next few weeks π The classic is this one :) Which feels more closer to Swagger UI #1858 (comment) |
Nah, I like the new one better (modern even), but I think you'd want to be able to choose if/which SwaggerUI you want. That's why I'd like it to be part of the generator, but in a way that it just adds a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things are missing
- The UI loads
/spec.json
, which should not be served (at all) - The
/documentation/json
endpoint is listed in the UI (see fastify-swagger on how to hide it) -
/documentation/yaml
is missing -
terser
is added as a dependency and it does not seem used. -
@scalar/api-reference
does not seem to be used in production, only to get a type (it also has a massive dependency list) - it seems the UI is loading a file from a fixed URL (in
@fastify/swagger-ui
it is relative), which is tricky when composing plugins. - please avoid the use of
console
, use the logging facilities. - prefer the use of
return html
orreturn reply.send(html)
to avoid forking the promise chain. Note that in those cases both handlers do not need to be async.
Appreciate the review @mcollina ; we will fix this up :) |
fa119c3
to
5f2730f
Compare
@mcollina just pushed up fixes, really appreciate your time and insights. All of these improvements really make the fastify-scalar integration way better! So we really appreciate that β¨
|
00f5657
to
0cb177a
Compare
There are still some console.logs: |
This also needs a rebase (sorry about it) |
We have two routes, one for HTML (which is using |
0cb177a
to
f21a09a
Compare
we removed node-fetch, I also tested every http snippet request and they worked. Was just node-fetch. We removed the stray console log. @hanspagel left a comment on this |
I've found two issues. The first is that all the Node.js snippets are for old libraries that I would not recommend:
What should be there is:
What's the snippet library are you using? we can likely add stuff there. The second issue is about the Web Client. You are adding all optional query parameters by default. This is a major difference compared to Swagger UI, where those are not added if not set. |
Appreciate the review! We are using httpsnippet-lite https://github.com/P0lip/httpsnippet/, will look into adding undici + fetch
Ah, yes we can fix this β¨ |
f21a09a
to
817d6d9
Compare
@mcollina we fixed the "... You are adding all optional query parameters by default. ..." issue :) as for the "Node.js snippets are for old libraries" comment, we realized that adding the two additional libraries is a larger body of work, but we have started the would be excited to fast follow with the undici + fetch snippet library after merge. But if you want those two snippet libraries finished first let me know :) |
817d6d9
to
1c15b2e
Compare
@mcollina I bring good news :) the wonderful @hanspagel pushed up the undici code snippets into Scalar ![]() ![]() |
Signed-off-by: marclave <marc@scalar.com>
Signed-off-by: marclave <marc@scalar.com>
1c15b2e
to
d23c3c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Signed-off-by: marclave <marc@scalar.com>
@mcollina looks like i was missing the tests that were failing should run now so we can kick those off again β¨ |
Signed-off-by: marclave <marc@scalar.com>
@mcollina i fixed the failing ci-db-core-test im not sure on |
yeah, we had a few CI problems. |
Signed-off-by: marclave <marc@scalar.com>
hey π platformatic,
I'm excited to get everyones feedback on integrating the Scalar Fastify plugin in Platformatic. I attached a preview of it working in the docs (see video below π ).
Some features Scalar brings:
An insane feature that was great to use when building out my demo project was to test the API right in the docs π€― felt like the developer experience for iterating and building was so fast! You can see it in the video :)
Some things we need to improve on but are a top priority π
I'm really excited to integrate Scalar, I think this is the beginning of a great partnership & I am eager for everyone's feedback on improving this PR & ensuring alignment before we get it merged β¨
CleanShot.2023-11-29.at.10.59.30.mp4
edit
I can squash my commits after feedback :)