Skip to content

Config class

openapi_core.Config dataclass

Bases: UnmarshallerConfig

OpenAPI configuration dataclass.

Read more information, in the OpenAPI-core docs for Configuration.

ATTRIBUTE DESCRIPTION
spec_validator_cls

Specification validator class.

TYPE: Union[SpecValidatorType, Unset]

spec_base_uri

Specification base URI. Deprecated, use base_uri parameter in OpenAPI.from_dict and OpenAPI.from_file if you want to define it.

TYPE: str

request_validator_cls

Request validator class.

TYPE: Union[RequestValidatorType, Unset]

response_validator_cls

Response validator class.

TYPE: Union[ResponseValidatorType, Unset]

webhook_request_validator_cls

Webhook request validator class.

TYPE: Union[WebhookRequestValidatorType, Unset]

webhook_response_validator_cls

Webhook response validator class.

TYPE: Union[WebhookResponseValidatorType, Unset]

request_unmarshaller_cls

Request unmarshaller class.

TYPE: Union[RequestUnmarshallerType, Unset]

response_unmarshaller_cls

Response unmarshaller class.

TYPE: Union[ResponseUnmarshallerType, Unset]

webhook_request_unmarshaller_cls

Webhook request unmarshaller class.

TYPE: Union[WebhookRequestUnmarshallerType, Unset]

webhook_response_unmarshaller_cls

Webhook response unmarshaller class.

TYPE: Union[WebhookResponseUnmarshallerType, Unset]

response_properties_default_policy

If true, require documented response properties (except writeOnly properties) in response validation and unmarshalling.

TYPE: Literal['optional', 'required']

Source code in openapi_core/configurations.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@dataclass
class Config(UnmarshallerConfig):
    """OpenAPI configuration dataclass.

    Read more information, in the
    [OpenAPI-core docs for Configuration](https://openapi-core.readthedocs.io/configuration/).

    Attributes:
        spec_validator_cls: Specification validator class.
        spec_base_uri: Specification base URI. Deprecated, use base_uri parameter in OpenAPI.from_dict and OpenAPI.from_file if you want to define it.
        request_validator_cls: Request validator class.
        response_validator_cls: Response validator class.
        webhook_request_validator_cls: Webhook request validator class.
        webhook_response_validator_cls: Webhook response validator class.
        request_unmarshaller_cls: Request unmarshaller class.
        response_unmarshaller_cls: Response unmarshaller class.
        webhook_request_unmarshaller_cls: Webhook request unmarshaller class.
        webhook_response_unmarshaller_cls: Webhook response unmarshaller class.
        response_properties_default_policy: If true, require documented response
            properties (except writeOnly properties) in response validation and
            unmarshalling.
    """

    spec_validator_cls: Union[SpecValidatorType, Unset] = _UNSET
    spec_base_uri: str = ""

    request_validator_cls: Union[RequestValidatorType, Unset] = _UNSET
    response_validator_cls: Union[ResponseValidatorType, Unset] = _UNSET
    webhook_request_validator_cls: Union[
        WebhookRequestValidatorType, Unset
    ] = _UNSET
    webhook_response_validator_cls: Union[
        WebhookResponseValidatorType, Unset
    ] = _UNSET
    request_unmarshaller_cls: Union[RequestUnmarshallerType, Unset] = _UNSET
    response_unmarshaller_cls: Union[ResponseUnmarshallerType, Unset] = _UNSET
    webhook_request_unmarshaller_cls: Union[
        WebhookRequestUnmarshallerType, Unset
    ] = _UNSET
    webhook_response_unmarshaller_cls: Union[
        WebhookResponseUnmarshallerType, Unset
    ] = _UNSET

Attributes

server_base_url class-attribute instance-attribute

server_base_url: Optional[str] = None

path_finder_cls class-attribute instance-attribute

path_finder_cls: Optional[PathFinderType] = None

webhook_path_finder_cls class-attribute instance-attribute

webhook_path_finder_cls: Optional[PathFinderType] = None

style_deserializers_factory class-attribute instance-attribute

style_deserializers_factory: Optional[
    StyleDeserializersFactory
] = None

media_type_deserializers_factory class-attribute instance-attribute

media_type_deserializers_factory: Optional[
    MediaTypeDeserializersFactory
] = None

schema_casters_factory class-attribute instance-attribute

schema_casters_factory: Optional[SchemaCastersFactory] = (
    None
)

schema_validators_factory class-attribute instance-attribute

schema_validators_factory: Optional[
    SchemaValidatorsFactory
] = None

extra_format_validators class-attribute instance-attribute

extra_format_validators: Optional[FormatValidatorsDict] = (
    None
)

extra_media_type_deserializers class-attribute instance-attribute

extra_media_type_deserializers: Optional[
    MediaTypeDeserializersDict
] = None

security_provider_factory class-attribute instance-attribute

security_provider_factory: SecurityProviderFactory = (
    security_provider_factory
)

additional_properties_default_policy class-attribute instance-attribute

additional_properties_default_policy: Literal[
    "allow", "forbid"
] = "allow"

response_properties_default_policy class-attribute instance-attribute

response_properties_default_policy: Literal[
    "optional", "required"
] = "optional"

schema_unmarshallers_factory class-attribute instance-attribute

schema_unmarshallers_factory: Optional[
    SchemaUnmarshallersFactory
] = None

extra_format_unmarshallers class-attribute instance-attribute

extra_format_unmarshallers: Optional[
    FormatUnmarshallersDict
] = None

spec_validator_cls class-attribute instance-attribute

spec_validator_cls: Union[SpecValidatorType, Unset] = _UNSET

spec_base_uri class-attribute instance-attribute

spec_base_uri: str = ''

request_validator_cls class-attribute instance-attribute

request_validator_cls: Union[
    RequestValidatorType, Unset
] = _UNSET

response_validator_cls class-attribute instance-attribute

response_validator_cls: Union[
    ResponseValidatorType, Unset
] = _UNSET

webhook_request_validator_cls class-attribute instance-attribute

webhook_request_validator_cls: Union[
    WebhookRequestValidatorType, Unset
] = _UNSET

webhook_response_validator_cls class-attribute instance-attribute

webhook_response_validator_cls: Union[
    WebhookResponseValidatorType, Unset
] = _UNSET

request_unmarshaller_cls class-attribute instance-attribute

request_unmarshaller_cls: Union[
    RequestUnmarshallerType, Unset
] = _UNSET

response_unmarshaller_cls class-attribute instance-attribute

response_unmarshaller_cls: Union[
    ResponseUnmarshallerType, Unset
] = _UNSET

webhook_request_unmarshaller_cls class-attribute instance-attribute

webhook_request_unmarshaller_cls: Union[
    WebhookRequestUnmarshallerType, Unset
] = _UNSET

webhook_response_unmarshaller_cls class-attribute instance-attribute

webhook_response_unmarshaller_cls: Union[
    WebhookResponseUnmarshallerType, Unset
] = _UNSET

Functions

__init__

__init__(
    server_base_url: Optional[str] = None,
    path_finder_cls: Optional[PathFinderType] = None,
    webhook_path_finder_cls: Optional[
        PathFinderType
    ] = None,
    style_deserializers_factory: Optional[
        StyleDeserializersFactory
    ] = None,
    media_type_deserializers_factory: Optional[
        MediaTypeDeserializersFactory
    ] = None,
    schema_casters_factory: Optional[
        SchemaCastersFactory
    ] = None,
    schema_validators_factory: Optional[
        SchemaValidatorsFactory
    ] = None,
    extra_format_validators: Optional[
        FormatValidatorsDict
    ] = None,
    extra_media_type_deserializers: Optional[
        MediaTypeDeserializersDict
    ] = None,
    security_provider_factory: SecurityProviderFactory = security_provider_factory,
    additional_properties_default_policy: Literal[
        "allow", "forbid"
    ] = "allow",
    response_properties_default_policy: Literal[
        "optional", "required"
    ] = "optional",
    schema_unmarshallers_factory: Optional[
        SchemaUnmarshallersFactory
    ] = None,
    extra_format_unmarshallers: Optional[
        FormatUnmarshallersDict
    ] = None,
    spec_validator_cls: Union[
        SpecValidatorType, Unset
    ] = _UNSET,
    spec_base_uri: str = "",
    request_validator_cls: Union[
        RequestValidatorType, Unset
    ] = _UNSET,
    response_validator_cls: Union[
        ResponseValidatorType, Unset
    ] = _UNSET,
    webhook_request_validator_cls: Union[
        WebhookRequestValidatorType, Unset
    ] = _UNSET,
    webhook_response_validator_cls: Union[
        WebhookResponseValidatorType, Unset
    ] = _UNSET,
    request_unmarshaller_cls: Union[
        RequestUnmarshallerType, Unset
    ] = _UNSET,
    response_unmarshaller_cls: Union[
        ResponseUnmarshallerType, Unset
    ] = _UNSET,
    webhook_request_unmarshaller_cls: Union[
        WebhookRequestUnmarshallerType, Unset
    ] = _UNSET,
    webhook_response_unmarshaller_cls: Union[
        WebhookResponseUnmarshallerType, Unset
    ] = _UNSET,
) -> None