Skip to content

Commit 953c935

Browse files
committed
Merge branch 'main' into responses-by-ref
# Conflicts: # tests/test_parser/test_openapi.py
2 parents c1a01cc + 5efa22b commit 953c935

File tree

48 files changed

+1896
-802
lines changed

Some content is hidden

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

48 files changed

+1896
-802
lines changed

.changeset/drop_support_for_python_38.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.changeset/type_is_now_a_reserved_field_name.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/workflows/checks.yml

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v4.2.2
1919
- name: Set up Python
20-
uses: actions/setup-python@v5.3.0
20+
uses: actions/setup-python@v5.4.0
2121
with:
2222
python-version: ${{ matrix.python }}
2323

@@ -51,27 +51,62 @@ jobs:
5151
- name: Run pytest without coverage
5252
if: matrix.os != 'ubuntu-latest'
5353
run: pdm test
54-
env:
55-
TASKIPY: true
5654

5755
- name: Run pytest with coverage
5856
if: matrix.os == 'ubuntu-latest'
5957
run: pdm test_with_coverage
60-
env:
61-
TASKIPY: true
62-
58+
6359
- run: mv .coverage .coverage.${{ matrix.python }}
6460
if: matrix.os == 'ubuntu-latest'
6561

6662
- name: Store coverage report
67-
uses: actions/upload-artifact@v4.4.3
63+
uses: actions/upload-artifact@v4.6.1
6864
if: matrix.os == 'ubuntu-latest'
6965
with:
7066
name: coverage-${{ matrix.python }}
7167
path: .coverage.${{ matrix.python }}
7268
if-no-files-found: error
7369
include-hidden-files: true
7470

71+
test_min_deps:
72+
strategy:
73+
matrix:
74+
os: [ ubuntu-latest, macos-latest, windows-latest ]
75+
runs-on: ${{ matrix.os }}
76+
steps:
77+
- uses: actions/checkout@v4.2.2
78+
- name: Set up Python
79+
uses: actions/setup-python@v5.4.0
80+
with:
81+
python-version: "3.9"
82+
83+
- name: Get Python Version
84+
id: get_python_version
85+
run: echo "python_version=$(python --version)" >> $GITHUB_OUTPUT
86+
shell: bash
87+
88+
- name: Cache dependencies
89+
uses: actions/cache@v4
90+
with:
91+
path: .venv
92+
key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-min-dependencies-${{ hashFiles('**/pdm.lock') }}
93+
restore-keys: |
94+
${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-min-dependencies
95+
- name: Install PDM
96+
run: pip install pdm
97+
98+
- name: Install minimum dependencies
99+
run: pdm install -L pdm.minimal.lock
100+
101+
- name: Run mypy
102+
run: pdm mypy --show-error-codes
103+
104+
- name: Lint
105+
run: pdm run ruff check .
106+
107+
- name: Run unit tests only # snapshots are expected to fail
108+
run: pdm unit_test
109+
75110
coverage:
76111
name: Combine & check coverage
77112
needs: test
@@ -82,7 +117,7 @@ jobs:
82117
with:
83118
python-version: "3.12"
84119
- name: Download coverage reports
85-
uses: actions/download-artifact@v4.1.8
120+
uses: actions/download-artifact@v4.1.9
86121
with:
87122
merge-multiple: true
88123

@@ -107,7 +142,7 @@ jobs:
107142
.venv/bin/python -m coverage report --fail-under=100
108143
109144
- name: Upload HTML report if check failed.
110-
uses: actions/upload-artifact@v4.4.3
145+
uses: actions/upload-artifact@v4.6.1
111146
with:
112147
name: html-report
113148
path: htmlcov
@@ -129,7 +164,7 @@ jobs:
129164
steps:
130165
- uses: actions/checkout@v4.2.2
131166
- name: Set up Python
132-
uses: actions/setup-python@v5.3.0
167+
uses: actions/setup-python@v5.4.0
133168
with:
134169
python-version: "3.9"
135170
- name: Get Python Version

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
- name: Build
1919
run: hatchling build
2020
- name: Push to PyPI
21-
uses: pypa/gh-action-pypi-publish@v1.12.2
21+
uses: pypa/gh-action-pypi-publish@v1.12.4
2222
with:
2323
attestations: true

CHANGELOG.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,71 @@ 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.23.1 (2025-01-13)
17+
18+
### Features
19+
20+
- allow Ruff 0.9 (#1192)
21+
22+
## 0.23.0 (2024-12-24)
23+
24+
### Breaking Changes
25+
26+
#### Delete fewer files with `--overwrite`
27+
28+
`--overwrite` will no longer delete the entire output directory before regenerating. Instead, it will only delete
29+
specific, known directories within that directory. Right now, that is only the generated `models` and `api` directories.
30+
31+
Other generated files, like `README.md`, will be overwritten. Extra files and directories outside of those listed above
32+
will be left untouched, so you can any extra modules or files around while still updating `pyproject.toml` automatically.
33+
34+
Closes #1105.
35+
36+
### Features
37+
38+
- Support httpx 0.28 (#1172)
39+
40+
#### Add `generate_all_tags` config option
41+
42+
You can now, optionally, generate **duplicate** endpoint functions/modules using _every_ tag for an endpoint,
43+
not just the first one, by setting `generate_all_tags: true` in your configuration file.
44+
45+
### Fixes
46+
47+
- Support Typer 0.14 and 0.15 (#1173)
48+
49+
#### Fix minimum `attrs` version
50+
51+
The minimum `attrs` dependency version was incorrectly set to 21.3.0. This has been corrected to 22.2.0, the minimum
52+
supported version since `openapi-python-client` 0.19.1.
53+
54+
Closes #1084, thanks @astralblue!
55+
56+
#### Fix compatibility with Pydantic 2.10+
57+
58+
##1176 by @Viicos
59+
60+
Set `defer_build` to models that we know will fail to build, and call `model_rebuild`
61+
in the `__init__.py` file.
62+
63+
## 0.22.0 (2024-11-23)
64+
65+
### Breaking Changes
66+
67+
#### Drop support for Python 3.8
68+
69+
Python 3.8 is no longer supported. "New" 3.9 syntax, like generics on builtin collections, is used both in the generator
70+
and the generated code.
71+
72+
#### `type` is now a reserved field name
73+
74+
Because `type` is used in type annotations now, it is no longer a valid field name. Fields which were previously named
75+
`type` will be renamed to `type_`.
76+
77+
### Features
78+
79+
- Support Ruff 0.8 (#1169)
80+
1681
## 0.21.7 (2024-10-28)
1782

1883
### Fixes

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ literal_enums: true
108108

109109
This is especially useful if enum values, when transformed to their Python names, end up conflicting due to case sensitivity or special symbols.
110110

111+
### generate_all_tags
112+
113+
`openapi-python-client` generates module names within the `api` module based on the OpenAPI `tags` of each endpoint.
114+
By default, only the _first_ tag is generated. If you want to generate **duplicate** endpoint functions using _every_ tag
115+
listed, you can enable this option:
116+
117+
```yaml
118+
generate_all_tags: true
119+
```
120+
111121
### project_name_override and package_name_override
112122

113123
Used to change the name of generated client library project/package. If the project name is changed but an override for the package name

end_to_end_tests/__snapshots__/test_end_to_end.ambr

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
# serializer version: 1
2+
# name: test_documents_with_errors[bad-status-code]
3+
'''
4+
Generating /test-documents-with-errors
5+
Warning(s) encountered while generating. Client was generated, but some pieces may be missing
6+
7+
WARNING parsing GET / within default.
8+
9+
Invalid response status code abcdef (not a valid HTTP status code), response will be omitted from generated client
10+
11+
12+
If you believe this was a mistake or this tool is missing a feature you need, please open an issue at https://github.com/openapi-generators/openapi-python-client/issues/new/choose
13+
14+
'''
15+
# ---
216
# name: test_documents_with_errors[circular-body-ref]
317
'''
418
Generating /test-documents-with-errors

end_to_end_tests/baseline_openapi_3.0.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,9 +1163,7 @@
11631163
},
11641164
"/tag_with_number": {
11651165
"get": {
1166-
"tags": [
1167-
"1"
1168-
],
1166+
"tags": ["1", "2"],
11691167
"responses": {
11701168
"200": {
11711169
"description": "Success"

end_to_end_tests/baseline_openapi_3.1.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,9 +1155,7 @@ info:
11551155
},
11561156
"/tag_with_number": {
11571157
"get": {
1158-
"tags": [
1159-
"1"
1160-
],
1158+
"tags": ["1", "2"],
11611159
"responses": {
11621160
"200": {
11631161
"description": "Success"

end_to_end_tests/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ class_overrides:
1111
field_prefix: attr_
1212
content_type_overrides:
1313
openapi/python/client: application/json
14+
generate_all_tags: true

0 commit comments

Comments
 (0)