Results of 1 - 3 of about 3 for APIRoute (0.001 sec.)
- Custom Request and APIRoute class 11924
- Custom Request and APIRoute class Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In some cases, you may want to override the logic used by the Request and APIRoute
...g custom request body encodings Let's see how to make use of a custom Request subclass to decompress gzip requests. And an APIRoute subclass to use that custom request class. Create a custom GzipRequest class Tip This is a toy example to demonstrate how...zip from typing import Callable , List from fastapi import Body , FastAPI , Request , Response from fastapi.routing import APIRoute class GzipRequest ( Request ): async def body ( self ) -> bytes : if not hasattr ( self , "_body" ): body = await super ()...etlist ( "Content-Encoding" ): body = gzip . decompress ( body ) self . _body = body return self . _body class GzipRoute ( APIRoute ): def get_route_handler ( self ) -> Callable : original_route_handler = super () . get_route_handler () async def custom_... - https://man.mtool.work/fastapi/0.115/how-to/custom-request-and-route/
- Path Operationの高度な設定 8036
- Path Operationの高度な設定 OpenAPI operationId 注意 あなたがOpenAPIの「エキスパート」でなければ、これは必要ないかもしれません。 path operation で operation_id パラメータを利用することで、OpenAPIの operationId を設定できます。 operation_id は
...る APIの関数名を operationId として利用したい場合、すべてのAPIの関数をイテレーションし、各 path operation の operationId を APIRoute.name で上書きすれば可能です。 そうする場合は、すべての path operation を追加した後に行う必要があります。 Python 3.8+ from...fastapi import FastAPI from fastapi.routing import APIRoute app = FastAPI () @app . get ( "/items/" ) async def read_items (): return [{ "item_id" : "Foo" }] def use_route_names_as_o...ion names. Should be called only after all routes have been added. """ for route in app . routes : if isinstance ( route , APIRoute ): route . operation_id = route . name # in this case, 'read_items' use_route_names_as_operation_ids ( app ) 豆知識 app.op... - https://man.mtool.work/fastapi/0.115/advanced/path-operation-advanced-configurat...
- Generate Clients 7924
- 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,
...nd also for the names of any needed custom models, for requests or responses. You can customize that function. It takes an APIRoute and outputs a string. For example, here it is using the first tag (you will probably have only one tag) and the path opera...FastAPI as the generate_unique_id_function parameter: Python 3.9+ from fastapi import FastAPI from fastapi.routing import APIRoute from pydantic import BaseModel def custom_generate_unique_id ( route : APIRoute ): return f " { route . tags [ 0 ] } - { r...? Other versions and variants Python 3.8+ from typing import List from fastapi import FastAPI from fastapi.routing import APIRoute from pydantic import BaseModel def custom_generate_unique_id ( route : APIRoute ): return f " { route . tags [ 0 ] } - { r... - https://man.mtool.work/fastapi/0.115/advanced/generate-clients/
PREV
1
NEXT