Skip to content
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

Add documentation for static swagger (#112) #557

Merged
merged 7 commits into from
Nov 23, 2019
Merged

Add documentation for static swagger (#112) #557

merged 7 commits into from
Nov 23, 2019

Conversation

svalouch
Copy link
Contributor

This adds an example for overwriting the location for the JS and CSS
files for the docs and redoc endpoints.

@codecov
Copy link

codecov bot commented Sep 22, 2019

Codecov Report

Merging #557 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #557    +/-   ##
======================================
  Coverage     100%   100%            
======================================
  Files         269    271     +2     
  Lines        6823   7067   +244     
======================================
+ Hits         6823   7067   +244
Impacted Files Coverage Δ
...utorial/test_extending_openapi/test_tutorial002.py 100% <100%> (ø)
docs/src/extending_openapi/tutorial002.py 100% <100%> (ø)
...est_additional_responses_custom_validationerror.py 100% <0%> (ø) ⬆️
docs/src/app_testing/tutorial003.py 100% <0%> (ø) ⬆️
...t_query_params_str_validations/test_tutorial001.py 100% <0%> (ø) ⬆️
tests/test_custom_swagger_ui_redirect.py 100% <0%> (ø) ⬆️
docs/src/first_steps/tutorial001.py 100% <0%> (ø) ⬆️
tests/test_additional_responses_router.py 100% <0%> (ø) ⬆️
docs/src/application_configuration/tutorial001.py 100% <0%> (ø) ⬆️
tests/test_swagger_ui_init_oauth.py 100% <0%> (ø) ⬆️
... and 75 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65536cb...ea3fd76. Read the comment docs.

This adds an example for overwriting the location for the JS and CSS
files for the docs and redoc endpoints.
@svalouch
Copy link
Contributor Author

Okay, coverage is good now. I'm using the documented method in my projects, but I'm not entirely sure if it's the easiest way to achieve the goal.

@svalouch svalouch mentioned this pull request Oct 11, 2019
@tiangolo
Copy link
Member

Great! Thanks. 🚀

I updated it a bit with more instructions so that people can use it and test it right away.

@tiangolo tiangolo merged commit 723ef07 into fastapi:master Nov 23, 2019
@youngquan
Copy link
Contributor

I have followed the steps in docs, and it really worked.

However, it's not very friendly to the novice. I wonder whether these steps could be down with pip install fastapi[all] or something else? How about an paramenter named offline like Fastapi(offline=True).

There is no internet where I am working, I tried to use fastapi and have found that the docs were not rendering. I had to import these JSs and CSSs extra. I hope fastapi could be more useful in an offline scenario.

@EdgeSync
Copy link

I have followed the steps in docs, and it really worked.

However, it's not very friendly to the novice. I wonder whether these steps could be down with pip install fastapi[all] or something else? How about an paramenter named offline like Fastapi(offline=True).

There is no internet where I am working, I tried to use fastapi and have found that the docs were not rendering. I had to import these JSs and CSSs extra. I hope fastapi could be more useful in an offline scenario.

Agree completely with this. Would be very useful to have the Fastapi(offline=True) option.

@tiangolo
Copy link
Member

tiangolo commented Apr 14, 2020

@youngquan , @EdgeSync that would mean that FastAPI would have to bundle all the JS and static files increasing a lot its size, that would also increase the complexity maintaining it as it would have to get a recent version of those assets at build time, etc.

Given that, you could also create a third-party package that bundles those files and that can be installed, that could provide a FastAPI router with the docs endpoints, etc. 🤓 💯

@youngquan
Copy link
Contributor

@tiangolo Thanks for you time. A third-party package is a good choice, I will try to porvide a one soon or later if I have time. ✋😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants