8000 Merge branch 'main' into multipart-boundary · linkdd/openapi-python-client@b1ca087 · GitHub
[go: up one dir, main page]

Skip to content

Commit b1ca087

Browse files
authored
Merge branch 'main' into multipart-boundary
2 
10000
parents c46d511 + a97dad1 commit b1ca087

File tree

35 files changed

+1084
-539
lines changed

35 files changed

+1084
-539
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
default: major
3+
---
4+
5+
# `const` values in responses are now validated at runtime
6+
7+
Prior to this version, `const` values returned from servers were assumed to always be correct. Now, if a server returns
8+
an unexpected value, the client will raise a `ValueError`. This should enable better usage with `oneOf`.
9+
10+
PR #1024. Thanks @peter-greenatlas!
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
default: major
3+
---
4+
5+
# Switch YAML parsing to 1.2
6+
7+
This change switches the YAML parsing library to `ruamel.yaml` which follows the YAML 1.2 specification.
8+
[There are breaking changes](https://yaml.readthedocs.io/en/latest/pyyaml/#defaulting-to-yaml-12-support) from YAML 1.1 to 1.2,
9+
though they will not affect most use cases.
10+
11+
PR #1042 fixes #1041. Thanks @rtaycher!

.github/workflows/checks.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
os: [ ubuntu-latest, macos-latest, windows-latest ]
1616
runs-on: ${{ matrix.os }}
1717
steps:
18-
- uses: actions/checkout@v4.1.1
18+
- uses: actions/checkout@v4.1.3
1919
- name: Set up Python
20-
uses: actions/setup-python@v5.0.0
20+
uses: actions/setup-python@v5.1.0
2121
with:
2222
python-version: ${{ matrix.python }}
2323

@@ -67,7 +67,7 @@ jobs:
6767
if: matrix.os == 'ubuntu-latest'
6868

6969
- name: Store coverage report
70-
uses: actions/upload-artifact@v4.3.1
70+
uses: actions/upload-artifact@v4.3.3
7171
if: matrix.os == 'ubuntu-latest'
7272
with:
7373
name: coverage-${{ matrix.python }}
@@ -79,12 +79,12 @@ jobs:
7979
needs: test
8080
runs-on: ubuntu-latest
8181
steps:
82-
- uses: actions/checkout@v4.1.1
82+
- uses: actions/checkout@v4.1.3
8383
- uses: actions/setup-python@v5
8484
with:
8585
python-version: "3.12"
8686
- name: Download coverage reports
87-
uses: actions/download-artifact@v4.1.4
87+
uses: actions/download-artifact@v4.1.6
8888
with:
8989
merge-multiple: true
9090

@@ -109,7 +109,7 @@ jobs:
109109
.venv/bin/python -m coverage report --fail-under=100
110110
111111
- name: Upload HTML report if check failed.
112-
uses: actions/upload-artifact@v4.3.1
112+
uses: actions/upload-artifact@v4.3.3
113113
with:
114114
name: html-report
115115
path: htmlcov
@@ -129,9 +129,9 @@ jobs:
129129
ports:
130130
- "3000:3000"
131131
steps:
132-
- uses: actions/checkout@v4.1.1
132+
- uses: actions/checkout@v4.1.3
133133
- name: Set up Python
134-
uses: actions/setup-python@v5.0.0
134+
uses: actions/setup-python@v5.1.0
135135
with:
136136
python-version: "3.8"
137137
- name: Get Python Version

.github/workflows/preview_release_pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ jobs:
77
if: "!contains(github.event.head_commit.message, 'chore: prepare release')" # Skip merges from releases
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v4.1.1
10+
- uses: actions/checkout@v4.1.3
1111
with:
1212
fetch-depth: 0
1313
token: ${{ secrets.PAT }}
1414
- name: Configure Git
1515
run: |
1616
git config --global user.name GitHub Actions
1717
git config user.email github-actions@github.com
18-
- uses: knope-dev/action@v2.0.0
18+
- uses: knope-dev/action@v2.1.0
1919
with:
20-
version: 0.14.1
20+
version: 0.16.2
2121
- run: knope prepare-release --verbose
2222
env:
2323
GITHUB_TOKEN: ${{ secrets.PAT }}

.github/workflows/release-dry-run.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ jobs:
66
release:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v4.1.1
9+
- uses: actions/checkout@v4.1.3
1010
with:
1111
fetch-depth: 0
1212
token: ${{ secrets.GITHUB_TOKEN }}
1313
- name: Install Knope
14-
uses: knope-dev/action@v2.0.0
14+
uses: knope-dev/action@v2.1.0
1515
with:
16-
version: 0.14.1
16+
version: 0.16.2
1717
- run: knope prepare-release --dry-run

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212
permissions:
1313
id-token: write
1414
steps:
15-
- uses: actions/checkout@v4.1.1
15+
- uses: actions/checkout@v4.1.3
1616
with:
1717
fetch-depth: 0
1818
token: ${{ secrets.PAT }}
1919
- name: Install Knope
20-
uses: knope-dev/action@v2.0.0
20+
uses: knope-dev/action@v2.1.0
2121
with:
22-
version: 0.14.1
22+
version: 0.16.2
2323
- name: Install Hatchling
2424
run: pip install --upgrade hatchling
2525
- name: Build

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,31 @@ 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.19.1 (2024-03-27)
17+
18+
### Features
19+
20+
#### Add config option to override content types
21+
22+
You can now define a `content_type_overrides` field in your `config.yml`:
23+
24+
```yaml
25+
content_type_overrides:
26+
application/zip: application/octet-stream
27+
```
28+
29+
This allows `openapi-python-client` to generate code for content types it doesn't recognize.
30+
31+
PR #1010 closes #810. Thanks @gaarutyunov!
32+
33+
### Fixes
34+
35+
#### Add aliases to `Client` for pyright
36+
37+
This should resolve incompatibilities between the generated `Client` class and the pyright type checker.
38+
39+
PR #1009 closes #909. Thanks @patrick91!
40+
1641
## 0.19.0 (2024-03-06)
1742

1843
### Breaking Changes

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,16 @@ If this option results in conflicts, you will need to manually override class na
156156

157157
By default, the timeout for retrieving the schema file via HTTP is 5 seconds. In case there is an error when retrieving the schema, you might try and increase this setting to a higher value.
158158

159+
### content_type_overrides
160+
161+
Normally, `openapi-python-client` will skip any bodies or responses that it doesn't recognize the content type for.
162+
This config tells the generator to treat a given content type like another.
163+
164+
```yaml
165+
content_type_overrides:
166+
application/zip: application/octet-stream
167+
```
168+
159169
[changelog.md]: CHANGELOG.md
160170
[poetry]: https://python-poetry.org/
161171
[PDM]: https://pdm-project.org/latest/

end_to_end_tests/baseline_openapi_3.0.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,6 +1578,36 @@
15781578
}
15791579
}
15801580
}
1581+
},
1582+
"/config/content-type-override": {
1583+
"post": {
1584+
"tags": [
1585+
"config"
1586+
],
1587+
"summary": "Content Type Override",
1588+
"operationId": "content_type_override",
1589+
"requestBody": {
1590+
"content": {
1591+
"openapi/python/client": {
1592+
"schema": {
1593+
"type": "string"
1594+
}
1595+
}
1596+
}
1597+
},
1598+
"responses": {
1599+
"200": {
1600+
"description": "Successful Response",
1601+
"content": {
1602+
"openapi/python/client": {
1603+
"schema": {
1604+
"type": "string"
1605+
}
1606+
}
1607+
}
1608+
}
1609+
}
1610+
}
15811611
}
15821612
},
15831613
"components": {

end_to_end_tests/baseline_openapi_3.1.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,6 +1572,36 @@ info:
15721572
}
15731573
}
15741574
}
1575+
},
1576+
"/config/content-type-override": {
1577+
"post": {
1578+
"tags": [
1579+
"config"
1580+
],
1581+
"summary": "Content Type Override",
1582+
"operationId": "content_type_override",
1583+
"requestBody": {
1584+
"content": {
1585+
"openapi/python/client": {
1586+
"schema": {
1587+
"type": "string"
1588+
}
1589+
}
1590+
}
1591+
},
1592+
"responses": {
1593+
"200": {
1594+
"description": "Successful Response",
1595+
"content": {
1596+
"openapi/python/client": {
1597+
"schema": {
1598+
"type": "string"
1599+
}
1600+
}
1601+
}
1602+
}
1603+
}
1604+
}
15751605
}
15761606
}
15771607
"components": {

end_to_end_tests/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ class_overrides:
99
class_name: AnEnumValue
1010
module_name: an_enum_value
1111
field_prefix: attr_
12+
content_type_overrides:
13+
openapi/python/client: application/json

end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import Type
44

55
from .bodies import BodiesEndpoints
6+
from .config import ConfigEndpoints
67
from .default import DefaultEndpoints
78
from .defaults import DefaultsEndpoints
89
from .enums import EnumsEndpoints
@@ -64,3 +65,7 @@ def naming(cls) -> Type[NamingEndpoints]:
6465
@classmethod
6566
def parameter_references(cls) -> Type[ParameterReferencesEndpoints]:
6667
return ParameterReferencesEndpoints
68+
69+
@classmethod
70+
def config(cls) -> Type[ConfigEndpoints]:
71+
return ConfigEndpoints
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""Contains methods for accessing the API Endpoints"""
2+
3+
import types
4+
5+
from . import content_type_override
6+
7+
8+
class ConfigEndpoints:
9+
@classmethod
10+
def content_type_override(cls) -> types.ModuleType:
11+
"""
12+
Content Type Override
13+
"""
14+
return content_type_override

end_to_end_tests/golden-record/my_test_api_client/api/config/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)
0