utils.py — fastapi Source File
Architecture documentation for utils.py, a python file in the fastapi codebase. 38 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 0dcb823f_ea0d_bd04_752b_a3a3f875bba1["utils.py"] 49bf6a50_8793_6899_5793_f23aa939e5fd["copy"] 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> 49bf6a50_8793_6899_5793_f23aa939e5fd 4bfdbd5b_5d59_7c1e_5417_4a0d61a31a96["http.client"] 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> 4bfdbd5b_5d59_7c1e_5417_4a0d61a31a96 d01056e9_3915_bd46_d8dd_a25ff9c1e35c["inspect"] 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> d01056e9_3915_bd46_d8dd_a25ff9c1e35c 9c2c9cad_dfd2_7d1a_1c6d_b8a448285db4["warnings"] 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> 9c2c9cad_dfd2_7d1a_1c6d_b8a448285db4 07d79a2e_d4e9_0bbb_be90_936274444c8c["collections.abc"] 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> 07d79a2e_d4e9_0bbb_be90_936274444c8c 0dda2280_3359_8460_301c_e98c77e78185["typing"] 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> 0dda2280_3359_8460_301c_e98c77e78185 534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"] 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> 534f6e44_61b8_3c38_8b89_6934a6df9802 de395a51_26f8_3424_1af0_2f5bef39c893["routing.py"] 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> de395a51_26f8_3424_1af0_2f5bef39c893 aac750d7_00e7_a28d_9e64_89918311078b["__init__.py"] 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> aac750d7_00e7_a28d_9e64_89918311078b dc4a1804_f7b4_848b_3280_30523680d7b9["datastructures.py"] 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> dc4a1804_f7b4_848b_3280_30523680d7b9 c509eb0b_23fb_fa54_c7e7_d4bec7d2f3a9["DefaultPlaceholder"] 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> c509eb0b_23fb_fa54_c7e7_d4bec7d2f3a9 44d16dc7_66bf_1b26_893f_eb0f5695fda1["models.py"] 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> 44d16dc7_66bf_1b26_893f_eb0f5695fda1 575d42b6_61a5_5351_210d_0e7a8dd0084f["Dependant"] 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> 575d42b6_61a5_5351_210d_0e7a8dd0084f 9e602cbf_3139_86ae_5666_97b8806942de["utils.py"] 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> 9e602cbf_3139_86ae_5666_97b8806942de style 0dcb823f_ea0d_bd04_752b_a3a3f875bba1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import copy
import http.client
import inspect
import warnings
from collections.abc import Sequence
from typing import Any, Optional, Union, cast
from fastapi import routing
from fastapi._compat import (
ModelField,
Undefined,
get_definitions,
get_flat_models_from_fields,
get_model_name_map,
get_schema_from_model_field,
lenient_issubclass,
)
from fastapi.datastructures import DefaultPlaceholder
from fastapi.dependencies.models import Dependant
from fastapi.dependencies.utils import (
_get_flat_fields_from_params,
get_flat_dependant,
get_flat_params,
get_validation_alias,
)
from fastapi.encoders import jsonable_encoder
from fastapi.exceptions import FastAPIDeprecationWarning
from fastapi.openapi.constants import METHODS_WITH_BODY, REF_PREFIX
from fastapi.openapi.models import OpenAPI
from fastapi.params import Body, ParamTypes
from fastapi.responses import Response
from fastapi.types import ModelNameMap
from fastapi.utils import (
deep_dict_update,
generate_operation_id_for_path,
is_body_allowed_for_status_code,
)
from pydantic import BaseModel
from starlette.responses import JSONResponse
from starlette.routing import BaseRoute
from typing_extensions import Literal
validation_error_definition = {
"title": "ValidationError",
"type": "object",
"properties": {
"loc": {
"title": "Location",
"type": "array",
"items": {"anyOf": [{"type": "string"}, {"type": "integer"}]},
},
"msg": {"title": "Message", "type": "string"},
"type": {"title": "Error Type", "type": "string"},
"input": {"title": "Input"},
"ctx": {"title": "Context", "type": "object"},
},
"required": ["loc", "msg", "type"],
}
validation_error_response_definition = {
// ... (513 more lines)
Domain
Subdomains
Functions
Dependencies
- Body
- DefaultPlaceholder
- Dependant
- FastAPIDeprecationWarning
- OpenAPI
- ParamTypes
- __init__.py
- __init__.py
- _get_flat_fields_from_params
- collections.abc
- constants.py
- copy
- datastructures.py
- deep_dict_update
- encoders.py
- exceptions.py
- generate_operation_id_for_path
- get_flat_dependant
- get_flat_params
- get_validation_alias
- http.client
- inspect
- is_body_allowed_for_status_code
- jsonable_encoder
- models.py
- models.py
- params.py
- pydantic
- responses.py
- routing.py
- starlette.responses
- starlette.routing
- types.py
- typing
- typing_extensions
- utils.py
- utils.py
- warnings
Source
Frequently Asked Questions
What does utils.py do?
utils.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Routing subdomain.
What functions are defined in utils.py?
utils.py defines 9 function(s): _get_openapi_operation_parameters, generate_operation_id, generate_operation_summary, get_fields_from_routes, get_openapi, get_openapi_operation_metadata, get_openapi_operation_request_body, get_openapi_path, get_openapi_security_definitions.
What does utils.py depend on?
utils.py imports 38 module(s): Body, DefaultPlaceholder, Dependant, FastAPIDeprecationWarning, OpenAPI, ParamTypes, __init__.py, __init__.py, and 30 more.
What files import utils.py?
utils.py is imported by 2 file(s): applications.py, tutorial001_py39.py.
Where is utils.py in the architecture?
utils.py is located at fastapi/openapi/utils.py (domain: FastAPI, subdomain: Routing, directory: fastapi/openapi).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free