Skip to content

The version of the OpenAPI doc is now used as the generated library's… #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## 0.5.2 - unreleased
### Fixes
- The generated library's version is now the same as the OpenAPI doc's version (#134)

## 0.5.1 - 2020-08-05
### Fixes
- Relative paths are now allowed in securitySchemes/OAuthFlow/tokenUrl (#130).
Expand Down
8 changes: 6 additions & 2 deletions openapi_python_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def __init__(self, *, openapi: GeneratorData) -> None:

self.package_name: str = self.project_name.replace("-", "_")
self.package_dir: Path = self.project_dir / self.package_name
self.package_description = f"A client library for accessing {self.openapi.title}"
self.package_description: str = f"A client library for accessing {self.openapi.title}"
self.version: str = openapi.version

self.env.filters.update(self.TEMPLATE_FILTERS)

Expand Down Expand Up @@ -167,7 +168,10 @@ def _build_metadata(self) -> None:
pyproject_path = self.project_dir / "pyproject.toml"
pyproject_path.write_text(
pyproject_template.render(
project_name=self.project_name, package_name=self.package_name, description=self.package_description
project_name=self.project_name,
package_name=self.package_name,
version=self.version,
description=self.package_description,
)
)

Expand Down
2 changes: 1 addition & 1 deletion openapi_python_client/templates/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "{{ project_name }}"
version = "0.1.0"
version = "{{ version }}"
description = "{{ description }}"

authors = []
Expand Down
1 change: 1 addition & 0 deletions tests/test___init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ def test__build_metadata(self, mocker):
pyproject_template.render.assert_called_once_with(
project_name=project.project_name,
package_name=project.package_name,
version=project.version,
description=project.package_description,
)
pyproject_path.write_text.assert_called_once_with(pyproject_template.render())
Expand Down