Skip to content

Commit c28226e

Browse files
dbantyGitHub
and
GitHub
authored
chore: prepare release 0.18.0 (#975)
This PR was created by Knope. Merging it will create a new release ### Breaking Changes #### For custom templates, changed type of endpoint parameters **This does not affect projects that are not using `--custom-template-path`** The type of these properties on `Endpoint` has been changed from `Dict[str, Property]` to `List[Property]`: - `path_parameters` - `query_parameters` - `header_parameters` - `cookie_parameters` If your templates are very close to the default templates, you can probably just remove `.values()` anywhere it appears. The type of `iter_all_parameters()` is also different, you probably want `list_all_parameters()` instead. #### Updated generated config for Ruff v0.2 This only affects projects using the `generate` command, not the `update` command. The `pyproject.toml` file generated which configures Ruff for linting and formatting has been updated to the 0.2 syntax, which means it will no longer work with Ruff 0.1. #### Updated naming strategy for conflicting properties While fixing #922, some naming strategies were updated. These should mostly be backwards compatible, but there may be some small differences in generated code. Make sure to check your diffs before pushing updates to consumers! ### Features #### support httpx 0.27 (#974) ### Fixes #### Allow parameters with names differing only by case If you have two parameters to an endpoint named `mixedCase` and `mixed_case`, previously, this was a conflict and the endpoint would not be generated. Now, the generator will skip snake-casing the parameters and use the names as-is. Note that this means if neither of the parameters _was_ snake case, neither _will be_ in the generated code. Fixes #922 reported by @macmoritz & @benedikt-bartscher. #### Fix naming conflicts with properties in models with mixed casing If you had an object with two properties, where the names differed only by case, conflicting properties would be generated in the model, which then failed the linting step (when using default config). For example, this: ```yaml type: "object" properties: MixedCase: type: "string" mixedCase: type: "string" ``` Would generate a class like this: ```python class MyModel: mixed_case: str mixed_case: str ``` Now, neither of the properties will be forced into snake case, and the generated code will look like this: ```python class MyModel: MixedCase: str mixedCase: str ``` Co-authored-by: GitHub <github-actions@github.com>
1 parent eeb1326 commit c28226e

7 files changed

+71
-76
lines changed

.changeset/allow_parameters_with_names_differing_only_by_case.md

-10
This file was deleted.

.changeset/fix_naming_conflicts_with_properties_in_models.md

-32
This file was deleted.

.changeset/for_custom_templates_changed_type_of_endpoint_parameters.md

-18
This file was deleted.

.changeset/updated_generated_config_for_ruff_v02.md

-7
This file was deleted.

.changeset/updated_naming_strategy_for_conflicting_properties.md

-8
This file was deleted.

CHANGELOG.md

+70
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,76 @@ Programmatic usage of this project (e.g., importing it as a Python module) and t
1313

1414
The 0.x prefix used in versions for this project is to indicate that breaking changes are expected frequently (several times a year). Breaking changes will increment the minor number, all other changes will increment the patch number. You can track the progress toward 1.0 [here](https://github.com/openapi-generators/openapi-python-client/projects/2).
1515

16+
## 0.18.0 (2024-02-22)
17+
18+
### Breaking Changes
19+
20+
#### For custom templates, changed type of endpoint parameters
21+
22+
**This does not affect projects that are not using `--custom-template-path`**
23+
24+
The type of these properties on `Endpoint` has been changed from `Dict[str, Property]` to `List[Property]`:
25+
26+
- `path_parameters`
27+
- `query_parameters`
28+
- `header_parameters`
29+
- `cookie_parameters`
30+
31+
If your templates are very close to the default templates, you can probably just remove `.values()` anywhere it appears.
32+
33+
The type of `iter_all_parameters()` is also different, you probably want `list_all_parameters()` instead.
34+
35+
#### Updated generated config for Ruff v0.2
36+
37+
This only affects projects using the `generate` command, not the `update` command. The `pyproject.toml` file generated which configures Ruff for linting and formatting has been updated to the 0.2 syntax, which means it will no longer work with Ruff 0.1.
38+
39+
#### Updated naming strategy for conflicting properties
40+
41+
While fixing #922, some naming strategies were updated. These should mostly be backwards compatible, but there may be
42+
some small differences in generated code. Make sure to check your diffs before pushing updates to consumers!
43+
44+
### Features
45+
46+
#### support httpx 0.27 (#974)
47+
48+
### Fixes
49+
50+
#### Allow parameters with names differing only by case
51+
52+
If you have two parameters to an endpoint named `mixedCase` and `mixed_case`, previously, this was a conflict and the endpoint would not be generated.
53+
Now, the generator will skip snake-casing the parameters and use the names as-is. Note that this means if neither of the parameters _was_ snake case, neither _will be_ in the generated code.
54+
55+
Fixes #922 reported by @macmoritz & @benedikt-bartscher.
56+
57+
#### Fix naming conflicts with properties in models with mixed casing
58+
59+
If you had an object with two properties, where the names differed only by case, conflicting properties would be generated in the model, which then failed the linting step (when using default config). For example, this:
60+
61+
```yaml
62+
type: "object"
63+
properties:
64+
MixedCase:
65+
type: "string"
66+
mixedCase:
67+
type: "string"
68+
```
69+
70+
Would generate a class like this:
71+
72+
```python
73+
class MyModel:
74+
mixed_case: str
75+
mixed_case: str
76+
```
77+
78+
Now, neither of the properties will be forced into snake case, and the generated code will look like this:
79+
80+
```python
81+
class MyModel:
82+
MixedCase: str
83+
mixedCase: str
84+
```
85+
1686
## 0.17.3 (2024-02-20)
1787
1888
### Fixes

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies = [
1818
"typing-extensions>=4.8.0,<5.0.0",
1919
]
2020
name = "openapi-python-client"
21-
version = "0.17.3"
21+
version = "0.18.0"
2222
description = "Generate modern Python clients from OpenAPI"
2323
keywords = [
2424
"OpenAPI",

0 commit comments

Comments
 (0)