コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 10 of about 19 for Schema (0.004 sec.)
Extending OpenAPI 14616
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 ... ) process, is as follows. A FastAPI application (instance) has an .openapi() method that is expected to return the OpenAPI schema. As part of the application object creation, a path operation for /openapi.json (or for whatever you set your openapi_url ... result of the application's .openapi() method. By default, what the 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. ... 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 custom logo . Normal F ...
https://man.mtool.work/fastapi/0.115/how-to/extending-openapi/
Custom Docs UI Static Assets (Self-Hosting) 10962
Custom Docs UI Static Assets (Self-Hosting) Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . The API docs use Swagger UI and ReDoc , and each of those need some Jav ... swagger_ui_oauth2_redirect_html , ) app = FastAPI ( docs_url = None , redoc_url = None ) @app . get ( "/docs" , include_in_schema = False ) async def custom_swagger_ui_html (): return get_swagger_ui_html ( openapi_url = app . openapi_url , title = app ... = "https://unpkg.com/swagger-ui-dist@5/swagger-ui.css" , ) @app . get ( app . swagger_ui_oauth2_redirect_url , include_in_schema = False ) async def swagger_ui_redirect (): return get_swagger_ui_oauth2_redirect_html () @app . get ( "/redoc" , include_ ... in_schema = False ) async def redoc_html (): return get_redoc_html ( openapi_url = app . openapi_url , title = app . title + " - ReD ...
https://man.mtool.work/fastapi/0.115/how-to/custom-docs-ui-assets/
スキーマの追加 - 例 9818
スキーマの追加 - 例 JSON Schemaに追加する情報を定義することができます。 一般的なユースケースはこのドキュメントで示されているように example を追加することです。 JSON Schemaの追加情報を宣言する方法はいくつかあります。 Pydanticの schema_extra ... Pydanticのドキュメント: スキーマのカスタマイズ で説明されているように、 Config と schema_extra を使ってPydanticモデルの例を宣言することができます: Python 3.8+ from typing import Union from fastapi import FastAPI ... e : str description : Union [ str , None ] = None price : float tax : Union [ float , None ] = None model_config = { "json_schema_extra" : { "examples" : [ { "name" : "Foo" , "description" : "A very nice Item" , "price" : 35.4 , "tax" : 3.2 , } ] } } @ ... m ( BaseModel ): name : str description : str | None = None price : float tax : float | None = None model_config = { "json_schema_extra" : { "examples" : [ { "name" : "Foo" , "description" : "A very nice Item" , "price" : 35.4 , "tax" : 3.2 , } ] } } @ ...
https://man.mtool.work/fastapi/0.115/tutorial/schema-extra-example/
Additional Responses in OpenAPI 9545
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 ... , with additional status codes, media types, descriptions, etc. Those additional responses will be included in the OpenAPI schema, so they will also appear in the API docs. But for those additional responses you have to make sure you return a Response ... 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 code 404 and a Pyda ... se 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 JSON object ( dict ...
https://man.mtool.work/fastapi/0.115/advanced/additional-responses/
Behind a Proxy 8520
Behind a Proxy Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In some situations, you might need to use a proxy server like Traefik or Nginx with a configuration ... would work as normally. But then, when you open the integrated docs UI (the frontend), it would expect to get the OpenAPI schema at /openapi.json , instead of /api/v1/openapi.json . So, the frontend (that runs in the browser) would try to reach /opena ... pi.json and wouldn't be able to get the OpenAPI schema. Because we have a proxy with a path prefix of /api/v1 for our app, the frontend needs to fetch the OpenAPI schema at /api ... to mean that the program listens on all the IPs available in that machine/server. The docs UI would also need the OpenAPI schema to declare that this API server is located at /api/v1 (behind the proxy). For example: { "openapi" : "3.1.0" , // More stu ...
https://man.mtool.work/fastapi/0.115/advanced/behind-a-proxy/
GraphQL 8486
GraphQL 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 ASGI standard, it's very easy to integrate any GraphQL library also compatible w ... rawberry . type class Query : @strawberry . field def user ( self ) -> User : return User ( name = "Patrick" , age = 100 ) schema = strawberry . Schema ( query = Query ) graphql_app = GraphQLRouter ( schema ) app = FastAPI () app . include_router ( gra ...
https://man.mtool.work/fastapi/0.115/how-to/graphql/
Release Notes 8213
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 ... 2 by @alejsdev . ✅ Simplify tests for request_form_models . PR #13183 by @alejsdev . ✅ Simplify tests for separate_openapi_schemas. PR #13201 by @alejsdev . ✅ Simplify tests for security. PR #13200 by @alejsdev . ✅ Simplify tests for schema_extra_examp ... ate includes in docs/de/docs/tutorial/middleware.md . PR #12729 by @paintdog . ? Update includes for docs/en/docs/tutorial/schema-extra-example.md . PR #12822 by @tiangolo . ? Update includes in docs/fr/docs/advanced/additional-responses.md . PR #12634 ... /docs/how-to/configure-swagger-ui.md . PR #12556 by @tiangolo . ? Update includes for docs/en/docs/how-to/separate-openapi-schemas.md . PR #12555 by @tiangolo . ? Update includes for docs/en/docs/advanced/security/http-basic-auth.md . PR #12553 by @tia ...
https://man.mtool.work/fastapi/0.115/release-notes/
Separate OpenAPI Schemas for Input and Output or Not 8093
Separate OpenAPI Schemas for Input and Output or Not Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . When using Pydantic v2 , the generated OpenAPI is a bit more e ... xact and correct than before. ? In fact, in some cases, it will even have two JSON Schemas in OpenAPI for the same Pydantic model, for input and output, depending on if they have default values . Let's see how th ... o describe this in OpenAPI, is to mark that field as required , because it will always be there. Because of that, the JSON Schema for a model can be different depending on if it's used for input or output : for input the description will not be require ... ription are marked as required with a red asterisk : Model for Input and Output in Docs And if you check all the available Schemas (JSON Schemas) in OpenAPI, you will see that there are two, one Item-Input and one Item-Output . For Item-Input , descrip ...
https://man.mtool.work/fastapi/0.115/how-to/separate-openapi-schemas/
Path Operationの高度な設定 7854
Path Operationの高度な設定 OpenAPI operationId 注意 あなたがOpenAPIの「エキスパート」でなければ、これは必要ないかもしれません。 path operation で operation_id パラメータを利用することで、OpenAPIの operationId を設定できます。 operation_id は ... ら除外する 生成されるOpenAPIスキーマ (つまり、自動ドキュメント生成の仕組み) から path operation を除外するには、 include_in_schema パラメータを False にします。 Python 3.8+ from fastapi import FastAPI app = FastAPI () @app . get ( "/items/" , include_in ... _schema = False ) async def read_items (): return [{ "item_id" : "Foo" }] docstringによる説明の高度な設定 path operation関数 のdoc ...
https://man.mtool.work/fastapi/0.115/advanced/path-operation-advanced-configurat...
Configure Swagger UI 7820
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 ... e) { return key === "" ? value : decodeURIComponent(value); } ) : {} ; isValid = qp.state === sentState; if (( oauth2.auth.schema.get("flow") === "accessCode" || oauth2.auth.schema.get("flow") === "authorizationCode" || oauth2.auth.schema.get("flow") = ...
https://man.mtool.work/fastapi/0.115/how-to/configure-swagger-ui/
PREV 1 2 NEXT