Skip to content

Commit

Permalink
fix formatting and python incompatibilty
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-rp committed Apr 29, 2024
1 parent d9a73eb commit 719e425
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions openapi_python_client/parser/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ def schema_and_name_from_reference(self, ref: Union[osp.Reference, osp.Schema])
name = name or schema.title
return name, schema

def response_from_reference(self, ref: osp.Reference | osp.Response) -> osp.Response:
def response_from_reference(self, ref: Union[osp.Reference, osp.Response]) -> osp.Response:
if isinstance(ref, osp.Response):
return ref
return osp.Response.parse_obj(self._component_from_reference(ref))
# return cast(osp.Response, self._component_from_reference(ref))

def schema_from_reference(self, ref: osp.Reference | osp.Schema) -> osp.Schema:
def schema_from_reference(self, ref: Union[osp.Reference, osp.Schema]) -> osp.Schema:
if isinstance(ref, osp.Schema):
return ref
return osp.Schema.parse_obj(self._component_from_reference(ref))
Expand Down
24 changes: 12 additions & 12 deletions openapi_python_client/parser/prompts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import dataclass
from typing import Any
from typing import Any, Union

from openapi_python_client.parser.endpoints import Endpoint

Expand All @@ -9,11 +9,11 @@ class PropInfo:
json_path: str
is_optional: bool
types: list[str]
type_format: str | None
description: str | None
type_format: Union[str, None]
description: Union[str, None]
examples: list[Any]
maximum: float | None
default: Any | None
maximum: Union[float, None]
default: Union[Any, None]

def __str__(self) -> str:
ret = ""
Expand All @@ -37,8 +37,8 @@ def __str__(self) -> str:
@dataclass
class ResponseInfo:
status_code: str
description: str | None
schema_description: str | None
description: Union[str, None]
schema_description: Union[str, None]
properties: list[PropInfo]

def __str__(self) -> str:
Expand All @@ -60,11 +60,11 @@ class ParamInfo:
name: str
required: bool
types: list[str]
type_format: str | None
description: str | None
type_format: Union[str, None]
description: Union[str, None]
examples: list[Any]
maximum: float | None
default: Any | None
maximum: Union[float, None]
default: Union[Any, None]
location: str

def __str__(self) -> str:
Expand All @@ -91,7 +91,7 @@ def __str__(self) -> str:
class EndpointInfo:
path: str
method: str
description: str | None
description: Union[str, None]
response: ResponseInfo
parameters: list[ParamInfo]

Expand Down
1 change: 1 addition & 0 deletions tests/test___main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# type: ignore


def test_main(mocker):
app = mocker.patch("openapi_python_client.cli.app")

Expand Down

0 comments on commit 719e425

Please sign in to comment.