Skip to content

Commit f2e84aa

Browse files
committed
Merge branch 'upstream-main' into discriminators
2 parents 0a8b3f7 + 861ef56 commit f2e84aa

File tree

216 files changed

+1743
-1331
lines changed

Some content is hidden

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

216 files changed

+1743
-1331
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
default: major
3+
---
4+
5+
# Drop support for Python 3.8
6+
7+
Python 3.8 is no longer supported. "New" 3.9 syntax, like generics on builtin collections, is used both in the generator
8+
and the generated code.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
default: major
3+
---
4+
5+
# `type` is now a reserved field name
6+
7+
Because `type` is used in type annotations now, it is no longer a valid field name. Fields which were previously named
8+
`type` will be renamed to `type_`.

.github/workflows/checks.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ jobs:
1111
test:
1212
strategy:
1313
matrix:
14-
python: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
14+
python: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
1515
os: [ ubuntu-latest, macos-latest, windows-latest ]
1616
runs-on: ${{ matrix.os }}
1717
steps:
18-
- uses: actions/[email protected].1
18+
- uses: actions/[email protected].2
1919
- name: Set up Python
20-
uses: actions/setup-python@v5.2.0
20+
uses: actions/setup-python@v5.3.0
2121
with:
2222
python-version: ${{ matrix.python }}
2323

@@ -77,7 +77,7 @@ jobs:
7777
needs: test
7878
runs-on: ubuntu-latest
7979
steps:
80-
- uses: actions/[email protected].1
80+
- uses: actions/[email protected].2
8181
- uses: actions/setup-python@v5
8282
with:
8383
python-version: "3.12"
@@ -127,11 +127,11 @@ jobs:
127127
ports:
128128
- "3000:3000"
129129
steps:
130-
- uses: actions/[email protected].1
130+
- uses: actions/[email protected].2
131131
- name: Set up Python
132-
uses: actions/setup-python@v5.2.0
132+
uses: actions/setup-python@v5.3.0
133133
with:
134-
python-version: "3.8"
134+
python-version: "3.9"
135135
- name: Get Python Version
136136
id: get_python_version
137137
run: echo "python_version=$(python --version)" >> $GITHUB_OUTPUT

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
permissions:
1313
id-token: write
1414
steps:
15-
- uses: actions/[email protected].1
15+
- uses: actions/[email protected].2
1616
- name: Install Hatchling
1717
run: pip install --upgrade hatchling
1818
- name: Build
1919
run: hatchling build
2020
- name: Push to PyPI
21-
uses: pypa/gh-action-pypi-publish@v1.10.3
21+
uses: pypa/gh-action-pypi-publish@v1.12.2
2222
with:
2323
attestations: true

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ 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.21.7 (2024-10-28)
17+
18+
### Fixes
19+
20+
- allow required fields list to be specified as empty (#651) (#1149)
21+
- import cast for required const properties, since it's used in the template (#1153)
22+
1623
## 0.21.6 (2024-10-20)
1724

1825
### Features

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ To request a feature:
4141
### Setting up a Dev Environment
4242

4343
1. Make sure you have [PDM](https://pdm-project.org) installed and up to date.
44-
2. Make sure you have a supported Python version (e.g. 3.8) installed.
44+
2. Make sure you have a supported Python version (e.g. 3.13) installed.
4545
3. Use `pdm install` in the project directory to create a virtual environment with the relevant dependencies.
4646

4747
### Writing tests

end_to_end_tests/baseline_openapi_3.0.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,47 @@
16661666
}
16671667
}
16681668
}
1669+
},
1670+
"/models/oneof-with-required-const": {
1671+
"get": {
1672+
"responses": {
1673+
"200": {
1674+
"description": "OK",
1675+
"content": {
1676+
"application/json": {
1677+
"schema": {
1678+
"oneOf": [
1679+
{
1680+
"type": "object",
1681+
"properties": {
1682+
"type": {
1683+
"const": "alpha"
1684+
},
1685+
"color": {
1686+
"type": "string"
1687+
}
1688+
},
1689+
"required": ["type"]
1690+
},
1691+
{
1692+
"type": "object",
1693+
"properties": {
1694+
"type": {
1695+
"const": "beta"
1696+
},
1697+
"texture": {
1698+
"type": "string"
1699+
}
1700+
},
1701+
"required": ["type"]
1702+
}
1703+
]
1704+
}
1705+
}
1706+
}
1707+
}
1708+
}
1709+
}
16691710
}
16701711
},
16711712
"components": {

end_to_end_tests/baseline_openapi_3.1.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,6 +1657,47 @@ info:
16571657
}
16581658
}
16591659
},
1660+
"/models/oneof-with-required-const": {
1661+
"get": {
1662+
"responses": {
1663+
"200": {
1664+
"description": "OK",
1665+
"content": {
1666+
"application/json": {
1667+
"schema": {
1668+
"oneOf": [
1669+
{
1670+
"type": "object",
1671+
"properties": {
1672+
"type": {
1673+
"const": "alpha"
1674+
},
1675+
"color": {
1676+
"type": "string"
1677+
}
1678+
},
1679+
"required": ["type"]
1680+
},
1681+
{
1682+
"type": "object",
1683+
"properties": {
1684+
"type": {
1685+
"const": "beta"
1686+
},
1687+
"texture": {
1688+
"type": "string"
1689+
}
1690+
},
1691+
"required": ["type"]
1692+
}
1693+
]
1694+
}
1695+
}
1696+
}
1697+
}
1698+
}
1699+
}
1700+
}
16601701
}
16611702
"components":
16621703
"schemas": {
Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Contains methods for accessing the API"""
22

3-
from typing import Type
4-
53
from .bodies import BodiesEndpoints
64
from .config import ConfigEndpoints
75
from .default import DefaultEndpoints
@@ -19,53 +17,53 @@
1917

2018
class MyTestApiClientApi:
2119
@classmethod
22-
def bodies(cls) -> Type[BodiesEndpoints]:
20+
def bodies(cls) -> type[BodiesEndpoints]:
2321
return BodiesEndpoints
2422

2523
@classmethod
26-
def tests(cls) -> Type[TestsEndpoints]:
24+
def tests(cls) -> type[TestsEndpoints]:
2725
return TestsEndpoints
2826

2927
@classmethod
30-
def defaults(cls) -> Type[DefaultsEndpoints]:
28+
def defaults(cls) -> type[DefaultsEndpoints]:
3129
return DefaultsEndpoints
3230

3331
@classmethod
34-
def enums(cls) -> Type[EnumsEndpoints]:
32+
def enums(cls) -> type[EnumsEndpoints]:
3533
return EnumsEndpoints
3634

3735
@classmethod
38-
def responses(cls) -> Type[ResponsesEndpoints]:
36+
def responses(cls) -> type[ResponsesEndpoints]:
3937
return ResponsesEndpoints
4038

4139
@classmethod
42-
def default(cls) -> Type[DefaultEndpoints]:
40+
def default(cls) -> type[DefaultEndpoints]:
4341
return DefaultEndpoints
4442

4543
@classmethod
46-
def parameters(cls) -> Type[ParametersEndpoints]:
44+
def parameters(cls) -> type[ParametersEndpoints]:
4745
return ParametersEndpoints
4846

4947
@classmethod
50-
def tag1(cls) -> Type[Tag1Endpoints]:
48+
def tag1(cls) -> type[Tag1Endpoints]:
5149
return Tag1Endpoints
5250

5351
@classmethod
54-
def location(cls) -> Type[LocationEndpoints]:
52+
def location(cls) -> type[LocationEndpoints]:
5553
return LocationEndpoints
5654

5755
@classmethod
58-
def true_(cls) -> Type[True_Endpoints]:
56+
def true_(cls) -> type[True_Endpoints]:
5957
return True_Endpoints
6058

6159
@classmethod
62-
def naming(cls) -> Type[NamingEndpoints]:
60+
def naming(cls) -> type[NamingEndpoints]:
6361
return NamingEndpoints
6462

6563
@classmethod
66-
def parameter_references(cls) -> Type[ParameterReferencesEndpoints]:
64+
def parameter_references(cls) -> type[ParameterReferencesEndpoints]:
6765
return ParameterReferencesEndpoints
6866

6967
@classmethod
70-
def config(cls) -> Type[ConfigEndpoints]:
68+
def config(cls) -> type[ConfigEndpoints]:
7169
return ConfigEndpoints

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
import types
44

5-
from . import get_common_parameters, get_models_allof, post_common_parameters, reserved_parameters
5+
from . import (
6+
get_common_parameters,
7+
get_models_allof,
8+
get_models_oneof_with_required_const,
9+
post_common_parameters,
10+
reserved_parameters,
11+
)
612

713

814
class DefaultEndpoints:
@@ -21,3 +27,7 @@ def reserved_parameters(cls) -> types.ModuleType:
2127
@classmethod
2228
def get_models_allof(cls) -> types.ModuleType:
2329
return get_models_allof
30+
31+
@classmethod
32+
def get_models_oneof_with_required_const(cls) -> types.ModuleType:
33+
return get_models_oneof_with_required_const

0 commit comments

Comments
 (0)