コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 10 of about 13 for generate (0.004 sec.)
Generate Clients 14094
Generate Clients Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . As FastAPI is based on the OpenAPI specification, you get automatic compatibility with many tools, ... the automatic API docs (provided by Swagger UI). One particular advantage that is not necessarily obvious is that you can generate clients (sometimes called SDKs ) for your API, for many different programming languages . OpenAPI Client Generators There ... are many tools to generate clients from OpenAPI . A common tool is OpenAPI Generator . If you are building a frontend , a very interesting alternativ ... and SDK generators based on OpenAPI (FastAPI), in some cases they can offer you additional features on top of high-quality generated SDKs/clients. Some of them also ✨ sponsor FastAPI ✨, this ensures the continued and healthy development of FastAPI and it ...
https://man.mtool.work/fastapi/0.115/advanced/generate-clients/
yieldを持つ依存関係 11138
yieldを持つ依存関係 FastAPIは、いくつかの 終了後の追加のステップ を行う依存関係をサポートしています。 これを行うには、 return の代わりに yield を使い、その後に追加のステップを書きます。 豆知識 yield は必ず一度だけ使用するようにしてください。 ... y_a に、依存することができます: Python 3.8+ - non-Annotated from fastapi import Depends async def dependency_a (): dep_a = generate_dep_a () try : yield dep_a finally : dep_a . close () async def dependency_b ( dep_a = Depends ( dependency_a )): dep_b = ... () try : yield dep_b finally : dep_b . close ( dep_a ) async def dependency_c ( dep_b = Depends ( dependency_b )): dep_c = generate_dep_c () try : yield dep_c finally : dep_c . close ( dep_b ) ? Other versions and variants Python 3.9+ Python 3.8+ from ty ... ping import Annotated from fastapi import Depends async def dependency_a (): dep_a = generate_dep_a () try : yield dep_a finally : dep_a . close () async def dependency_b ( dep_a : Annotated [ DepA , Depends ( depend ...
https://man.mtool.work/fastapi/0.115/tutorial/dependencies/dependencies-with-yie...
Extending OpenAPI 8780
Extending OpenAPI Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . There are some cases where you might need to modify the generated OpenAPI schema. In this section ... method .openapi() does is check the property .openapi_schema to see if it has contents and return them. If it doesn't, it generates them using the utility function at fastapi.openapi.utils.get_openapi . And that function get_openapi() receives as parame ... by FastAPI 0.99.0 and above. Overriding the defaults Using the information above, you can use the same utility function to generate the OpenAPI schema and override each part that you need. For example, let's add ReDoc's OpenAPI extension to include a cus ... o-margin/logo-teal.png" } app . openapi_schema = openapi_schema return app . openapi_schema app . openapi = custom_openapi Generate the OpenAPI schema Then, use the same utility function to generate the OpenAPI schema, inside a custom_openapi() function: ...
https://man.mtool.work/fastapi/0.115/how-to/extending-openapi/
OpenAPI models 8569
OpenAPI models OpenAPI Pydantic models used to generate and validate the generated OpenAPI. ::: fastapi.openapi.models ...
https://man.mtool.work/fastapi/0.115/reference/openapi/models/
カスタムレスポンス - HTML、ストリーム、ファイル、その他のレスポンス 8375
カスタムレスポンス - HTML、ストリーム、ファイル、その他のレスポンス デフォルトでは、 FastAPI は JSONResponse を使ってレスポンスを返します。 レスポンスを直接返す で見たように、 Response を直接返すことでこの挙動をオーバーライドできます。 しか ... このようになります: Python 3.8+ from fastapi import FastAPI from fastapi.responses import HTMLResponse app = FastAPI () def generate_html_response (): html_content = """ <html> <head> <title>Some HTML in here</title> </head> <body> <h1>Look ma! HTML!</h1> ... tml_content , status_code = 200 ) @app . get ( "/items/" , response_class = HTMLResponse ) async def read_items (): return generate_html_response () この例では、関数 generate_html_response() は、 str のHTMLを返すのではなく Response を生成して返しています ... 。 generate_html_response() を呼び出した結果を返すことにより、 FastAPI の振る舞いを上書きする Response が既に返されています。 しかし、 ...
https://man.mtool.work/fastapi/0.115/advanced/custom-response/
Configure Swagger UI 8217
Configure Swagger UI Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can configure some extra Swagger UI parameters . To configure them, pass the swagger_ui_pa ... gger_ui_default_parameters][fastapi.openapi.docs.swagger_ui_default_parameters]. """ ), ] = None , ) -> HTMLResponse : """ Generate and return the HTML that loads Swagger UI for the interactive API docs (normally served at `/docs`). You would only call t ... g" , with_google_fonts : Annotated [ bool , Doc ( """ Load and use Google Fonts. """ ), ] = True , ) -> HTMLResponse : """ Generate and return the HTML response that loads ReDoc for the alternative API docs (normally served at `/redoc`). You would only c ... /script> </body> </html> """ return HTMLResponse ( html ) def get_swagger_ui_oauth2_redirect_html () -> HTMLResponse : """ Generate the HTML response with the OAuth2 redirection for Swagger UI. You normally don't need to use or change this. """ # copied ...
https://man.mtool.work/fastapi/0.115/how-to/configure-swagger-ui/
Additional Responses in OpenAPI 8005
Additional Responses in OpenAPI Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Warning This is a rather advanced topic. If you are starting with FastAPI , you mig ... sponse dict s can have a key model , containing a Pydantic model, just like response_model . FastAPI will take that model, generate its JSON Schema and include it in the correct place in OpenAPI. For example, to declare another response with a status cod ... urn the JSONResponse directly. Info The model key is not part of OpenAPI. FastAPI will take the Pydantic model from there, generate the JSON Schema, and put it in the correct place. The correct place is: In the key content , that has as value another JSO ... is way, other applications and clients can use those JSON Schemas directly, provide better code generation tools, etc. The generated responses in the OpenAPI for this path operation will be: { "responses" : { "404" : { "description" : "Additional Respons ...
https://man.mtool.work/fastapi/0.115/advanced/additional-responses/
Development - Contributing 8005
Development - Contributing Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . First, you might want to see the basic ways to help FastAPI and get help . Developing If ... rmat.sh It will also auto-sort all your imports. Tests There is a script that you can run locally to test all the code and generate coverage reports in HTML: $ bash scripts/test-cov-html.sh This command generates a directory ./htmlcov/ , if you open the ... t yet there in the docs. Checking the link from above, the code for "Creole" is ht . The next step is to run the script to generate a new translation directory: // Use the command new-lang, pass the language code as a CLI argument $ python ./scripts/docs ... r: es Successfully built docs for: es This builds all those independent MkDocs sites for each language, combines them, and generates the final output at ./site/ . Then you can serve that with the command serve : // Use the command "serve" after running " ...
https://man.mtool.work/fastapi/0.115/contributing/
Release Notes 8005
Release Notes Latest Changes 0.115.11 Fixes ? Add docs examples and tests (support) for Annotated custom validations, like AfterValidator , revert #13440 . PR #13442 by @tiangolo . New docs: Query Parameters and String Validations - Custom ... on for docs/ru/docs/deployment/docker.md . PR #13048 by @anklav24 . ? Add Portuguese translation for docs/pt/docs/advanced/generate-clients.md . PR #13030 by @vitumenezes . ? Add Indonesian translation for docs/id/docs/tutorial/first-steps.md . PR #13042 ... pendabot[bot] . ⬆ Bump mkdocs-macros-plugin from 1.0.5 to 1.3.7. PR #13133 by @dependabot[bot] . ? Add internal scripts to generate language translations with PydanticAI, include Spanish prompt. PR #13123 by @tiangolo . ⬆ Bump astral-sh/setup-uv from 4 t ... in docs/de/docs/advanced/additional-responses.md . PR #12821 by @zhaohan-dong . ? Update includes in docs/en/docs/advanced/generate-clients.md . PR #12642 by @AyushSinghal1794 . ? Fix admonition double quotes with new syntax. PR #12835 by @tiangolo . ? U ...
https://man.mtool.work/fastapi/0.115/release-notes/
Templates 7900
Templates Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can use any template engine you want with FastAPI . A common choice is Jinja2, the same one used by F ... used by your path operation function . So, the section with: <a href=" {{ url_for ( 'read_item' , id = id ) }} "> ...will generate a link to the same URL that would be handled by the path operation function read_item(id=id) . For example, with an ID of ...
https://man.mtool.work/fastapi/0.115/advanced/templates/
PREV 1 2 NEXT