-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
DRAFT: Use FastAPI to put asyncio shims on top of OL API calls #5898
Conversation
Won't have time to check it out this week but I've been thinking about making OpenAPI docs forever and this would be fantastic! May also expose some inconsistencies in our APIs (like when we return 400 txt responses instead of json) |
Yeah this is 🔥 We can use this to generate a graphQL api using graphql mesh From there I want to both vend ready-made GraphQL-querying custom elements and create a PWA for library builders using Apollo Elements |
393c552
to
e9c21ef
Compare
|
Put this code at the bottom of
Generated code:
|
Update: This was done in #5910... This is nasty regex clutter... Would it break things if we manually transform it to |
Related to internetarchive/openlibrary#5898 and internetarchive/openlibrary#5910 Enable programmatic access to the docstrings of decorated `.GET()` methods. https://stackoverflow.com/questions/68733352
I updated the code above to add type hints, doctests, and only passing of |
|
Closing in favor of #5910 which automates the code generation. |
Related to #5590
Related to #5910
Related to #5914
DRAFT: Do not merge.
NOTE:
FastAPI/main.py.disabled
-->FastAPI/main.py
after FastAPI is added to our requirements.Use FastAPI to put a Python asyncio shim on top of calls to https://openlibrary.org.
Why?
Put the contents of
main.py.disabled
intomain.py
This starts an asyncio-based webserver that will auto-reload as changes are saved to
main.py
.Try:
main.py
Technical
Testing
See comments at the top of
FastAPI/test_fastapi_hack.py.disabled
Also, when the uvicorn server is running go to http://127.0.0.1:8000/docs and do Try it out under various endpoints.
Screenshot
Autogenerated content:
http://127.0.0.1:8000/docs
http://127.0.0.1:8000/redoc
Stakeholders
@bennypowers