-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
feat: add scalar integration (additional alternative to Swagger UI/Redoc) #10674
base: master
Are you sure you want to change the base?
Conversation
📝 Docs preview for commit fe9d070 at: https://3908a882.fastapitiangolo.pages.dev |
fe9d070
to
5439cb0
Compare
📝 Docs preview for commit 3a31862 at: https://e2b8a06b.fastapitiangolo.pages.dev |
3a31862
to
95803ef
Compare
📝 Docs preview for commit 95803ef at: https://52620119.fastapitiangolo.pages.dev |
📝 Docs preview for commit 36fc23f at: https://db2a9cdc.fastapitiangolo.pages.dev |
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.
@marclave Need scalar_url=None
here as well, probably? https://github.com/tiangolo/fastapi/pull/10674/files#diff-2acad16c8816cd891697cf09bc6158a64aeab4091ad4cb7a3e5cce88bb9a1a78R422
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.
@marclave Do you not need a conditional block similar to this one that exists for redoc, for scalar
?
we do have one right below where you referenced :) |
ah good catch! I wrote the tests for it but didnt update the docs there. Just pushed up a commit to fix this :) |
📝 Docs preview for commit 8a79d14 at: https://8318b0bb.fastapitiangolo.pages.dev |
8a79d14
to
08f43fd
Compare
📝 Docs preview for commit 08f43fd at: https://49a76bae.fastapitiangolo.pages.dev |
08f43fd
to
743a4c5
Compare
📝 Docs preview for commit 743a4c5 at: https://2f17ff93.fastapitiangolo.pages.dev |
743a4c5
to
aa04ee7
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, great job.
dfb30f8
to
e131330
Compare
e131330
to
e3e9c01
Compare
@marclave I'm quite excited about this. Hope you'll soon fix failed checks. |
@hasansezertasan im glad you're excited! We are too ✨ I'll fix up these build issues this weekend :) |
e3e9c01
to
5259f70
Compare
@tiangolo did something change with building of the docs? I might need to make a fresh PR but im not sure what's happening based on the logs. any guidance would be great ✨ |
Hello @marclave, is there any update on this? |
5259f70
to
adb7fd5
Compare
I'm not sure either. 😕 About the review, I recommend you to read this #10437 (comment) from the author, especially this sentence: "I'm also considering trimming a bit these things and simplify the way that automatic OpenAPI UIs are provided, probably removing the default ReDoc and making it opt-in. But that will come later." 😞 I interpreted that sentence as "No more alternative automatic OpenAPI UI's will be included.". What do you think about it @marclave? I also created a package called openapipages and included Scalar to it (based on this PR 🙏). I would not say no to a 🌟. Let me know what you think about it 🤓 |
Wow thanks for adding scalar @hasansezertasan ! I gave it a star 💫 Would be cool to add your package to the documentation of FastAPI then ✨ |
Thank you, I'm grateful 🙏. Of course, I'm gonna add Scalar API, it's a great tool (it's my fav so far)!
Well, where (which page) do you recommend adding it to? As far as I remember, FastAPI documentation doesn't have a page for third-party-extensions like Starlette (Third Party Packages - Starlette) |
I'm not entirely sure where it should go to be honest. But maybe in the root README? Or maybe we should have a page for third party extensions ✨ |
I'm not sure if the author would promote openapipages in the README but I believe there can be a page called "More Alternative Interfaces" next to "Configure Swagger UI" page that demonstrates Scalar integration using openapipages package. I also been longing for a third-party-extensions page. WDYT about it @tiangolo? I can work on "More Alternative Interfaces" page if you like the idea. Edit: I started a discussion at #11158, check it out 🥇. |
adb7fd5
to
a7f5717
Compare
we got an official integration! scalar/scalar#1534
from fastapi import FastAPI
from scalar_fastapi import get_scalar_api_reference
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/scalar", include_in_schema=False)
async def scalar_html():
return get_scalar_api_reference(
openapi_url=app.openapi_url,
) |
👋 hey FastAPI, long time fan of everyone's work here and have been eagerly wanting to integrate Scalar's open-source & MIT licensed OpenAPI/Swagger documentation tool to FastAPI.
preview of Scalar integrated with a custom FastAPI theme (not sure on where the best place to add a bit of css is for a custom theme ✨ )
You can play around with what Scalar is like here based on the PetStore https://fastapi.apidocumentation.com
This is also my first time contribution to FastAPI so I am excited for feedback and ready for any requested changes!