from __future__ import annotations from dataclasses import dataclass, field from typing import TYPE_CHECKING from litestar.openapi.spec.base import BaseSchemaObject __all__ = ("Components",) if TYPE_CHECKING: from litestar.openapi.spec.callback import Callback from litestar.openapi.spec.example import Example from litestar.openapi.spec.header import OpenAPIHeader from litestar.openapi.spec.link import Link from litestar.openapi.spec.parameter import Parameter from litestar.openapi.spec.path_item import PathItem from litestar.openapi.spec.reference import Reference from litestar.openapi.spec.request_body import RequestBody from litestar.openapi.spec.response import OpenAPIResponse from litestar.openapi.spec.schema import Schema from litestar.openapi.spec.security_scheme import SecurityScheme @dataclass class Components(BaseSchemaObject): """Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. """ schemas: dict[str, Schema] = field(default_factory=dict) """An object to hold reusable `Schema Objects `_""" responses: dict[str, OpenAPIResponse | Reference] | None = None """An object to hold reusable `Response Objects `_""" parameters: dict[str, Parameter | Reference] | None = None """An object to hold reusable `Parameter Objects `_""" examples: dict[str, Example | Reference] | None = None """An object to hold reusable `Example Objects `_""" request_bodies: dict[str, RequestBody | Reference] | None = None """An object to hold reusable `Request Body Objects `_""" headers: dict[str, OpenAPIHeader | Reference] | None = None """An object to hold reusable `Header Objects `_""" security_schemes: dict[str, SecurityScheme | Reference] | None = None """An object to hold reusable `Security Scheme Objects `_""" links: dict[str, Link | Reference] | None = None """An object to hold reusable `Link Objects `_""" callbacks: dict[str, Callback | Reference] | None = None """An object to hold reusable `Callback Objects `_""" path_items: dict[str, PathItem | Reference] | None = None """An object to hold reusable `Path Item Object `_"""