Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 60 additions & 120 deletions openapi_core/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,15 @@ def __init__(
self,
spec: Annotated[
SchemaPath,
Doc(
"""
Doc("""
OpenAPI specification schema path object.
"""
),
"""),
],
config: Annotated[
Optional[Config],
Doc(
"""
Doc("""
Configuration object for the OpenAPI application.
"""
),
"""),
] = None,
):
if not isinstance(spec, SchemaPath):
Expand All @@ -151,27 +147,21 @@ def from_dict(
cls,
data: Annotated[
Schema,
Doc(
"""
Doc("""
Dictionary representing the OpenAPI specification.
"""
),
"""),
],
config: Annotated[
Optional[Config],
Doc(
"""
Doc("""
Configuration object for the OpenAPI application.
"""
),
"""),
] = None,
base_uri: Annotated[
str,
Doc(
"""
Doc("""
Base URI for the OpenAPI specification.
"""
),
"""),
] = "",
) -> "OpenAPI":
"""Creates an `OpenAPI` from a dictionary.
Expand All @@ -194,19 +184,15 @@ def from_path(
cls,
path: Annotated[
Path,
Doc(
"""
Doc("""
Path object representing the OpenAPI specification file.
"""
),
"""),
],
config: Annotated[
Optional[Config],
Doc(
"""
Doc("""
Configuration object for the OpenAPI application.
"""
),
"""),
] = None,
) -> "OpenAPI":
"""Creates an `OpenAPI` from a [Path object](https://docs.python.org/3/library/pathlib.html#pathlib.Path).
Expand All @@ -229,19 +215,15 @@ def from_file_path(
cls,
file_path: Annotated[
str,
Doc(
"""
Doc("""
File path string representing the OpenAPI specification file.
"""
),
"""),
],
config: Annotated[
Optional[Config],
Doc(
"""
Doc("""
Configuration object for the OpenAPI application.
"""
),
"""),
] = None,
) -> "OpenAPI":
"""Creates an `OpenAPI` from a file path string.
Expand All @@ -264,27 +246,21 @@ def from_file(
cls,
fileobj: Annotated[
SupportsRead,
Doc(
"""
Doc("""
File object representing the OpenAPI specification file.
"""
),
"""),
],
config: Annotated[
Optional[Config],
Doc(
"""
Doc("""
Configuration object for the OpenAPI application.
"""
),
"""),
] = None,
base_uri: Annotated[
str,
Doc(
"""
Doc("""
Base URI for the OpenAPI specification.
"""
),
"""),
] = "",
) -> "OpenAPI":
"""Creates an `OpenAPI` from a [file object](https://docs.python.org/3/glossary.html#term-file-object).
Expand Down Expand Up @@ -542,11 +518,9 @@ def validate_request(
self,
request: Annotated[
AnyRequest,
Doc(
"""
Doc("""
Request object to be validated.
"""
),
"""),
],
) -> None:
"""Validates the given request object.
Expand All @@ -567,19 +541,15 @@ def validate_response(
self,
request: Annotated[
AnyRequest,
Doc(
"""
Doc("""
Request object associated with the response.
"""
),
"""),
],
response: Annotated[
Response,
Doc(
"""
Doc("""
Response object to be validated.
"""
),
"""),
],
) -> None:
"""Validates the given response object associated with the request.
Expand All @@ -601,11 +571,9 @@ def validate_apicall_request(
self,
request: Annotated[
Request,
Doc(
"""
Doc("""
API call request object to be validated.
"""
),
"""),
],
) -> None:
if not isinstance(request, Request):
Expand All @@ -616,19 +584,15 @@ def validate_apicall_response(
self,
request: Annotated[
Request,
Doc(
"""
Doc("""
API call request object associated with the response.
"""
),
"""),
],
response: Annotated[
Response,
Doc(
"""
Doc("""
API call response object to be validated.
"""
),
"""),
],
) -> None:
if not isinstance(request, Request):
Expand All @@ -641,11 +605,9 @@ def validate_webhook_request(
self,
request: Annotated[
WebhookRequest,
Doc(
"""
Doc("""
Webhook request object to be validated.
"""
),
"""),
],
) -> None:
if not isinstance(request, WebhookRequest):
Expand All @@ -656,19 +618,15 @@ def validate_webhook_response(
self,
request: Annotated[
WebhookRequest,
Doc(
"""
Doc("""
Webhook request object associated with the response.
"""
),
"""),
],
response: Annotated[
Response,
Doc(
"""
Doc("""
Webhook response object to be validated.
"""
),
"""),
],
) -> None:
if not isinstance(request, WebhookRequest):
Expand All @@ -681,11 +639,9 @@ def unmarshal_request(
self,
request: Annotated[
AnyRequest,
Doc(
"""
Doc("""
Request object to be unmarshalled.
"""
),
"""),
],
) -> RequestUnmarshalResult:
"""Unmarshals the given request object.
Expand All @@ -709,19 +665,15 @@ def unmarshal_response(
self,
request: Annotated[
AnyRequest,
Doc(
"""
Doc("""
Request object associated with the response.
"""
),
"""),
],
response: Annotated[
Response,
Doc(
"""
Doc("""
Response object to be unmarshalled.
"""
),
"""),
],
) -> ResponseUnmarshalResult:
"""Unmarshals the given response object associated with the request.
Expand All @@ -746,11 +698,9 @@ def unmarshal_apicall_request(
self,
request: Annotated[
Request,
Doc(
"""
Doc("""
API call request object to be unmarshalled.
"""
),
"""),
],
) -> RequestUnmarshalResult:
if not isinstance(request, Request):
Expand All @@ -761,19 +711,15 @@ def unmarshal_apicall_response(
self,
request: Annotated[
Request,
Doc(
"""
Doc("""
API call request object associated with the response.
"""
),
"""),
],
response: Annotated[
Response,
Doc(
"""
Doc("""
API call response object to be unmarshalled.
"""
),
"""),
],
) -> ResponseUnmarshalResult:
if not isinstance(request, Request):
Expand All @@ -786,11 +732,9 @@ def unmarshal_webhook_request(
self,
request: Annotated[
WebhookRequest,
Doc(
"""
Doc("""
Webhook request object to be unmarshalled.
"""
),
"""),
],
) -> RequestUnmarshalResult:
if not isinstance(request, WebhookRequest):
Expand All @@ -801,19 +745,15 @@ def unmarshal_webhook_response(
self,
request: Annotated[
WebhookRequest,
Doc(
"""
Doc("""
Webhook request object associated with the response.
"""
),
"""),
],
response: Annotated[
Response,
Doc(
"""
Doc("""
Webhook response object to be unmarshalled.
"""
),
"""),
],
) -> ResponseUnmarshalResult:
if not isinstance(request, WebhookRequest):
Expand Down
Loading
Loading