Skip to content

Commit 150c6f7

Browse files
authored
Merge pull request #172 from triaxtec/release/0.6.0
Release 0.6.0
2 parents b7fe79a + 96172c2 commit 150c6f7

File tree

78 files changed

+2698
-1614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2698
-1614
lines changed

.circleci/config.yml

+13-8
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,25 @@ jobs:
4444

4545
- run:
4646
name: Unit Tests
47-
command: poetry run pytest --junitxml=test-reports/pytest/results.xml --cov=openapi_python_client tests
47+
command: |
48+
poetry run pytest --junitxml=test-reports/pytest/results.xml --cov=openapi_python_client tests
49+
poetry run coverage xml
50+
51+
- codecov/upload:
52+
file: coverage.xml
4853

4954
- run:
5055
name: End to End Test
51-
command: poetry run pytest end_to_end_tests
56+
command: |
57+
poetry run pytest --junitxml=test-reports/pytest/results.xml --cov=openapi_python_client end_to_end_tests
58+
poetry run coverage xml
5259
53-
- run:
54-
name: Generate Coverage Report
55-
command: poetry run coverage xml
60+
- codecov/upload:
61+
file: coverage.xml
5662

5763
- store_test_results:
5864
path: test-reports
59-
- codecov/upload:
60-
file: coverage.xml
65+
6166
- run:
6267
command: poetry run pip uninstall openapi-python-client -y
6368
name: Uninstall Package
@@ -73,4 +78,4 @@ workflows:
7378
- test:
7479
matrix:
7580
parameters:
76-
python-version: ["3.7", "3.8"]
81+
python-version: ["3.6", "3.7", "3.8"]

.run/pytest.run.xml

-19
This file was deleted.

.run/run_fastapi.run.xml

-34
This file was deleted.

.run/tests.test_end_to_end.regen_golden_master.run.xml

-34
This file was deleted.

CHANGELOG.md

+93-29
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,44 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

45
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
56
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
67

8+
## 0.6.0 - Unreleased
9+
10+
### Breaking Changes
11+
12+
- Reorganized api calls in generated clients. `async_api` will no longer be generated. Each path operation will now
13+
have it's own module under its tag. For example, if there was a generated function `api.my_tag.my_function()` it is
14+
replaced with `api.my_tag.my_function.sync()`. The async version can be called with `asyncio()` instead of `sync()`.
15+
(#167)
16+
- Removed support for mutable default values (e.g. dicts, lists). They may be added back in a future version given enough
17+
demand, but the existing implementation was not up to this project's standards. (#170)
18+
- Removed generated `errors` module (and the `ApiResponseError` therein). Instead of raising an exception on failure,
19+
the `sync()` and `asyncio()` functions for a path operation will return `None`. This means all return types are now
20+
`Optional`, so mypy will require you to handle potential errors (or explicitly ignore them).
21+
- Moved `models.types` generated module up a level, so just `types`.
22+
- All generated classes that were `dataclass` now use the `attrs` package instead
23+
24+
### Additions
25+
26+
- Every generated API module will have a `sync_detailed()` and `asyncio_detailed()` function which work like their
27+
non-detailed counterparts, but return a `types.Response[T]` instead of an `Optional[T]` (where T is the parsed body type).
28+
`types.Response` contains `status_code`, `content` (bytes of returned content), `headers`, and `parsed` (the
29+
parsed return type you would get from the non-detailed function). (#115)
30+
- It's now possible to include custom headers and cookies in requests, as well as set a custom timeout. This can be done
31+
either by directly setting those parameters on a `Client` (e.g. `my_client.headers = {"Header": "Value"}`) or using
32+
a fluid api (e.g. `my_endpoint.sync(my_client.with_cookies({"MyCookie": "cookie"}).with_timeout(10.0))`).
33+
- Unsupported content types or no responses at all will no longer result in an endpoint being completely skipped. Instead,
34+
only the `detailed` versions of the endpoint will be generated, where the resulting `Response.parsed` is always `None`.
35+
(#141)
36+
- Support for Python 3.6 (#137 & #154)
37+
- Support for enums with integer values
38+
39+
### Changes
40+
41+
- The format of any errors/warnings has been spaced out a bit.
742

843
## 0.5.5 - 2020-09-04
944
### Fixes
@@ -12,128 +47,154 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1247

1348

1449
## 0.5.4 - 2020-08-29
50+
1551
### Additions
52+
1653
- Support for octet-stream content type (#116)
1754
- Support for [nullable](https://swagger.io/docs/specification/data-models/data-types/#null) (#99)
1855
- Union properties can be defined using oneOf (#98)
1956
- Support for lists of strings, integers, floats and booleans as responses (#165). Thanks @Maistho!
2057

21-
2258
## 0.5.3 - 2020-08-13
59+
2360
### Security
61+
2462
- All values that become file/directory names are sanitized to address path traversal vulnerabilities (CVE-2020-15141)
2563
- All values that get placed into python files (everything from enum names, to endpoint descriptions, to default values) are validated and/or saniziatied to address arbitrary code execution vulnerabilities (CVE-2020-15142)
2664

2765
### Changes
66+
2867
- Due to security concerns/implementation complexities, default values are temporarily unsupported for any `RefProperty` that doesn't refer to an enum.
29-
- Defaults for properties must now be valid values for their respective type (e.g. "example string" is an invalid default for an `integer` type property, and the function for an endpoint using it would fail to generate and be skipped).
68+
- Defaults for properties must now be valid values for their respective type (e.g. "example string" is an invalid default for an `integer` type property, and the function for an endpoint using it would fail to generate and be skipped).
3069

3170
### Additions
71+
3272
- Added support for header parameters (#117)
3373

3474
### Fixes
35-
- JSON bodies will now be assigned correctly in generated clients(#139 & #147). Thanks @pawamoy!
3675

76+
- JSON bodies will now be assigned correctly in generated clients(#139 & #147). Thanks @pawamoy!
3777

3878
## 0.5.2 - 2020-08-06
79+
3980
### Additions
81+
4082
- Added `project_name_override` and `package_name_override` config options to override the name of the generated project/package (#123)
4183
- The generated library's version is now the same as the OpenAPI doc's version (#134)
4284

43-
4485
## 0.5.1 - 2020-08-05
86+
4587
### Fixes
88+
4689
- Relative paths are now allowed in securitySchemes/OAuthFlow/tokenUrl (#130).
4790
- Schema validation errors will no longer print a stack trace (#131).
4891
- Invalid YAML/URL will no longer print stack trace (#128)
4992

50-
5193
## 0.5.0 - 2020-08-05
94+
5295
### Changes
96+
5397
- When encountering a problem, the generator will now differentiate between warnings (things it was able to skip past)
54-
and errors (things which halt generation altogether).
98+
and errors (things which halt generation altogether).
5599

56100
### Additions
101+
57102
- The generator can now handle many more errors gracefully, skipping the things it can't generate and continuing
58-
with the pieces it can.
103+
with the pieces it can.
59104
- Support for Enums declared in "components/schemas" and references to them (#102).
60105
- Generated clients can now be installed via pip (#120).
61106
- Support for YAML OpenAPI documents (#111)
62-
107+
63108
### Internal Changes
64-
- Switched OpenAPI document parsing to use Pydantic based on a vendored version of
65-
[openapi-schema-pydantic](https://github.com/kuimono/openapi-schema-pydantic/) (#103).
66-
- Tests can now be run on Windows.
67109

110+
- Switched OpenAPI document parsing to use Pydantic based on a vendored version of
111+
[openapi-schema-pydantic](https://github.com/kuimono/openapi-schema-pydantic/) (#103).
112+
- Tests can now be run on Windows.
68113

69114
## 0.4.2 - 2020-06-13
115+
70116
### Additions
117+
71118
- Support for responses with no content (#63 & #66). Thanks @acgray!
72119
- Support for custom string formats (#64 & #65). Thanks @acgray!
73120

74-
75121
## 0.4.1 - 2020-06-02
122+
76123
### Additions
77-
- Support for Python 3.7 (#58)
78124

125+
- Support for Python 3.7 (#58)
79126

80127
## 0.4.0 - 2020-05-30
128+
81129
### Breaking Changes
82-
- Classes generated to be included within lists will now be named like <ListName>Item. For example, if a property
83-
named "statuses" is an array of enum values, previously the `Enum` class declared would be called "Statuses". Now it
84-
will be called "StatusesItem". If a "title" attribute was used in the OpenAPI document, that should still be respected
85-
and used instead of the generated name. You can restore previous names by adding "StatusesItem" to the `class_overrides`
86-
section of a config file.
130+
131+
- Classes generated to be included within lists will now be named like <ListName>Item. For example, if a property
132+
named "statuses" is an array of enum values, previously the `Enum` class declared would be called "Statuses". Now it
133+
will be called "StatusesItem". If a "title" attribute was used in the OpenAPI document, that should still be respected
134+
and used instead of the generated name. You can restore previous names by adding "StatusesItem" to the `class_overrides`
135+
section of a config file.
87136
- Clients now require httpx ^0.13.0 (up from ^0.12.1). See [httpx release notes](https://github.com/encode/httpx/releases/tag/0.13.0)
88-
for details.
137+
for details.
89138

90139
### Additions
140+
91141
- Support for binary format strings (file payloads)
92142
- Support for multipart/form bodies
93143
- Support for any supported property within a list (array), including other lists.
94144
- Support for Union types ("anyOf" in OpenAPI document)
95145
- Support for more basic response types (integer, number, boolean)
96-
- Support for duplicate enums. Instead of erroring, enums with the same name (title) but differing values
97-
will have a number appended to the end. So if you have two conflicting enums named `MyEnum`, one of them
98-
will now be named `MyEnum1`. Note that the order in which these are processed and therefore named is entirely
99-
dependent on the order they are read from the OpenAPI document, so changes to the document could result
100-
in swapping the names of conflicting Enums.
146+
- Support for duplicate enums. Instead of erroring, enums with the same name (title) but differing values
147+
will have a number appended to the end. So if you have two conflicting enums named `MyEnum`, one of them
148+
will now be named `MyEnum1`. Note that the order in which these are processed and therefore named is entirely
149+
dependent on the order they are read from the OpenAPI document, so changes to the document could result
150+
in swapping the names of conflicting Enums.
101151

102152
### Changes
103-
- The way most imports are handled was changed which *should* lead to fewer unused imports in generated files.
153+
154+
- The way most imports are handled was changed which _should_ lead to fewer unused imports in generated files.
104155
- Better error messages
105-
- Most error messages will contain some useful information about why it failed instead of a stack trace
106-
- Client will still be generated if there are recoverable errors, excluding endpoints that had those errors
156+
- Most error messages will contain some useful information about why it failed instead of a stack trace
157+
- Client will still be generated if there are recoverable errors, excluding endpoints that had those errors
107158
- Output from isort and black when generating will now be suppressed
108159

109160
### Fixes
110-
- Defaults within models dataclasses for `Dict` or `List` properties will now be properly declared as a
111-
`field` with the `default_factory` parameter to prevent errors related to mutable defaults.
161+
162+
- Defaults within models dataclasses for `Dict` or `List` properties will now be properly declared as a
163+
`field` with the `default_factory` parameter to prevent errors related to mutable defaults.
112164

113165
## 0.3.0 - 2020-04-25
166+
114167
### Additions
168+
115169
- Link to the GitHub repository from PyPI (#26). Thanks @theY4Kman!
116170
- Support for date properties (#30, #37). Thanks @acgray!
117171
- Allow naming schemas by property name and Enums by title (#21, #31, #38). Thanks @acgray!
118172

119173
### Fixes
174+
120175
- Fixed some typing issues in generated clients and incorporate mypy into end to end tests (#32). Thanks @acgray!
121176
- Properly handle camelCase endpoint names and properties (#29, #36). Thanks @acgray!
122177

123178
## 0.2.1 - 2020-03-22
179+
124180
### Fixes
181+
125182
- Fixed import of errors.py in generated api modules
126183

127184
### Additions
185+
128186
- Support for lists of Enums
129187
- Add config for black to generated pyproject.toml
130188

131189
## 0.2.0 - 2020-03-22
190+
132191
### Changes
192+
133193
- Update Typer dependency to 0.1.0 and remove click-completion dependency (#19)
134194
- Switched to httpx from requests for both this tool and generated clients (#15)
135195

136196
### Additions
197+
137198
- `--version` option to print the version of openapi-python-client and exit
138199
- `--config` option for passing a config.yml file to override generated class names (#9)
139200
- Generated clients will now have some basic Poetry usage in their README.md (#13)
@@ -143,15 +204,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
143204
- A number of additions to the README including recommending pipx (#20)
144205

145206
## 0.1.2 - 2020-03-16
207+
146208
- Improve handling of optional properties in generated `to_dict` function for models
147209
- Add PEP 561 marker file (py.typed) to generated packages
148210

149211
## 0.1.1 - 2020-03-06
212+
150213
- Fix mypy issue in generated models `from_dict` with datetime or reference properties
151214
- Generated clients now raise an `ApiResponseError` if they receive a response that was not declared
152215
- Stop including optional query parameters when value is set to None
153216
- Added an `update` command to update a previously generated client
154217
- Added click-completion for installable tab completion in most shells
155218

156219
## 0.1.0 - 2020-02-28
220+
157221
- Initial Release

0 commit comments

Comments
 (0)