Skip to content
Merged
Changes from 1 commit
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
11 changes: 4 additions & 7 deletions openapi_python_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ def __init__(
package_version=self.version,
project_name=self.project_name,
project_dir=self.project_dir,
openapi=self.openapi,
endpoint_collections_by_tag=self.openapi.endpoint_collections_by_tag,
)
self.errors: List[GeneratorError] = []

Expand Down Expand Up @@ -264,18 +266,13 @@ def _build_api(self) -> None:
client_path.write_text(client_template.render(), encoding=self.file_encoding)

# Generate endpoints
endpoint_collections_by_tag = self.openapi.endpoint_collections_by_tag
api_dir = self.package_dir / "api"
api_dir.mkdir()
api_init_path = api_dir / "__init__.py"
api_init_template = self.env.get_template("api_init.py.jinja")
api_init_path.write_text(
api_init_template.render(
endpoint_collections_by_tag=endpoint_collections_by_tag,
),
encoding=self.file_encoding,
)
api_init_path.write_text(api_init_template.render(), encoding=self.file_encoding)

endpoint_collections_by_tag = self.openapi.endpoint_collections_by_tag
endpoint_template = self.env.get_template(
"endpoint_module.py.jinja", globals={"isbool": lambda obj: obj.get_base_type_string() == "bool"}
)
Expand Down