Skip to content

Commit 98a1e92

Browse files
committed
Merge branch 'main' into raise-on-error-code
2 parents e26e93f + 99638b1 commit 98a1e92

File tree

131 files changed

+5406
-933
lines changed

Some content is hidden

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

131 files changed

+5406
-933
lines changed

.github/renovate.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"extends": [
33
"config:base",
44
":semanticCommitTypeAll(chore)"
5-
]
5+
],
6+
"rangeStrategy": "widen"
67
}

.github/workflows/checks.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
test:
1111
strategy:
1212
matrix:
13-
python: [ "3.7", "3.8", "3.9", "3.10" ]
13+
python: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
1414
os: [ ubuntu-latest, macos-latest, windows-latest ]
1515
runs-on: ${{ matrix.os }}
1616
steps:
1717
- uses: actions/checkout@v3
1818
- name: Set up Python
19-
uses: actions/setup-python@v3
19+
uses: actions/setup-python@v4
2020
with:
2121
python-version: ${{ matrix.python }}
2222

@@ -67,7 +67,7 @@ jobs:
6767
shell: bash
6868
run: poetry run coverage xml
6969

70-
- uses: codecov/codecov-action@v2
70+
- uses: codecov/codecov-action@v3
7171
with:
7272
files: ./coverage.xml
7373

@@ -82,7 +82,7 @@ jobs:
8282
steps:
8383
- uses: actions/checkout@v3
8484
- name: Set up Python
85-
uses: actions/setup-python@v3
85+
uses: actions/setup-python@v4
8686
with:
8787
python-version: "3.10"
8888
- name: Get Python Version

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ jobs:
2929

3030
# Initializes the CodeQL tools for scanning.
3131
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@v1
32+
uses: github/codeql-action/init@v2
3333
# Override language selection by uncommenting this and choosing your languages
3434
with:
3535
languages: python
3636

3737
- name: Perform CodeQL Analysis
38-
uses: github/codeql-action/analyze@v1
38+
uses: github/codeql-action/analyze@v2

.github/workflows/pythonpublish.yml

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

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Release Dry Run
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
token: ${{ secrets.PAT }}
16+
- name: Install Knope
17+
uses: knope-dev/action@v1
18+
with:
19+
version: 0.6.2
20+
- run: knope release --dry-run

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
release:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
with:
11+
fetch-depth: 0
12+
token: ${{ secrets.PAT }}
13+
- name: Import GPG key
14+
uses: crazy-max/ghaction-import-gpg@v5
15+
with:
16+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
17+
git_user_signingkey: true
18+
git_commit_gpgsign: true
19+
git_push_gpgsign: false
20+
- name: Install Knope
21+
uses: knope-dev/action@v1
22+
with:
23+
version: 0.6.2
24+
- name: Bump Version & Create GitHub Release
25+
run: knope release
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.PAT }}
28+
- name: Install Poetry
29+
run: pip install --upgrade poetry
30+
- name: Push to PyPI
31+
run: poetry publish --build -u __token__ -p ${{ secrets.PYPI_TOKEN }}

CHANGELOG.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,80 @@ 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.12.2
17+
18+
### Fixes
19+
20+
- Support Python 3.11.0 (#701)
21+
22+
## 0.12.1
23+
24+
### Fixes
25+
26+
- Version bump due to PyPI error
27+
28+
## 0.12.0
29+
30+
### Breaking Changes
31+
32+
- Change the `Response.status_code` type to the `HTTPStatus` enum [#665]
33+
34+
### Features
35+
36+
- Add `endpoint_collections_by_tag` and `openapi` to the templating globals [#689]. Thanks @paulo-raca!
37+
- Support for recursive and circular references using lazy imports [#670, #338, #466]. Thanks @maz808 & @mtovt!
38+
- Include `__all__` in generated `__init__.py` files [#676, #631, #540, #675]. Thanks @EltonChou!
39+
40+
### Fixes
41+
42+
- If data.type is None but has data.properties, assume type is object [#691, #674]. Thanks @ahuang11!
43+
44+
## 0.11.6
45+
46+
### Features
47+
48+
- improve the error message when parsing a response fails [#659]. Thanks @supermihi!
49+
- Authorization header can now be customized in AuthenticatedClient [#660]. Thanks @supermihi!
50+
- Support inlined form data schema in requestBody [#656, #662]. Thanks @supermihi!
51+
- Allow enums in headers [#663, #667]. Thanks @supermihi!
52+
53+
### Fixes
54+
55+
- Exception when parsing documents which contain callbacks [#661]. Thanks @dachucky!
56+
57+
## 0.11.5
58+
59+
### Features
60+
61+
- support `#/components/parameters` references [#288, #615, #653]. Thanks @jsanchez7SC!
62+
63+
### Fixes
64+
65+
- Keep trailing newlines in generated files [#646, #654]. Thanks @eliask!
66+
67+
## 0.11.4
68+
69+
### Fixes
70+
71+
- Invalid code generation with some `oneOf` and `anyOf` combinations [#603, #642]. Thanks @jselig-rigetti!
72+
- Allow relative references in all URLs [#630]. Thanks @jtv8!
73+
74+
## 0.11.3
75+
76+
### Fixes
77+
78+
- Allow tokenUrl to be relative [#618]. Thanks @Fokko!
79+
80+
## 0.11.2
81+
82+
### Features
83+
84+
- Allow httpx 0.23.x (#617)
85+
86+
### Fixes
87+
88+
- typos in generated README (#586). Thanks @adelevie!
89+
1690
## 0.11.1
1791

1892
### Features

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
## Setting up a Dev Environment
1010

1111
1. Make sure you have [Poetry](https://python-poetry.org/) installed and up to date.
12-
2. Make sure you have a supported Python version (e.g. 3.8) installed and accessible to Poetry (e.g. with [pyenv](https://github.com/pyenv/pyenv).
12+
2. Make sure you have a supported Python version (e.g. 3.8) installed and accessible to Poetry (e.g. with [pyenv](https://github.com/pyenv/pyenv)).
1313
3. Use `poetry install` in the project directory to create a virtual environment with the relevant dependencies.
1414
4. Enter a `poetry shell` to make running commands easier.
1515

@@ -32,7 +32,7 @@
3232

3333
## Creating a Pull Request
3434

35-
Once you've written the code and run the checks, the next step is to create a pull request against the `main` branch of this repository. This repository uses [conventional commits] squashed on each PR, then uses [Dobby] to auto-generate CHANGELOG.md entries for release. So the title of your PR should be in the format of a conventional commit written in plain english as it will end up in the CHANGELOG. Some example PR titles:
35+
Once you've written the code and run the checks, the next step is to create a pull request against the `main` branch of this repository. This repository uses [conventional commits] squashed on each PR, then uses [Knope] to auto-generate CHANGELOG.md entries for release. So the title of your PR should be in the format of a conventional commit written in plain english as it will end up in the CHANGELOG. Some example PR titles:
3636

3737
- feat: Support for `allOf` in OpenAPI documents (closes #123).
3838
- refactor!: Removed support for Python 3.5
@@ -45,4 +45,4 @@ Once your PR is created, a series of automated checks should run. If any of them
4545
As soon as possible, your PR will be reviewed. If there are any changes requested there will likely be a bit of back and forth. Once this process is done, your changes will be merged into main and included in the next release. If you need your changes available on PyPI by a certain time, please mention it in the PR, and we'll do our best to accommodate.
4646

4747
[Conventional Commits]: https://www.conventionalcommits.org/en/v1.0.0/
48-
[Dobby]: https://triaxtec.github.io/dobby/introduction.html
48+
[Knope]: https://knope-dev.github.io/knope/

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,5 +157,13 @@ post_hooks:
157157
- "black ."
158158
```
159159

160+
### use_path_prefixes_for_title_model_names
161+
162+
By default, `openapi-python-client` generates class names which include the full path to the schema, including any parent-types. This can result in very long class names like `MyRouteSomeClassAnotherClassResponse`—which is very unique and unlikely to cause conflicts with future API additions, but also super verbose.
163+
164+
If you are carefully curating your `title` properties already to ensure no duplicate class names, you can turn off this prefixing feature by setting `use_path_prefixes_for_title_model_names` to `false` in your config file. This will use the `title` property of any object that has it set _without_ prefixing.
165+
166+
If this option results in conflicts, you will need to manually override class names instead via the `class_overrides` option.
167+
160168
[changelog.md]: CHANGELOG.md
161169
[poetry]: https://python-poetry.org/

dobby.toml

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

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
from .default import DefaultEndpoints
66
from .location import LocationEndpoints
7+
from .parameter_references import ParameterReferencesEndpoints
78
from .parameters import ParametersEndpoints
9+
from .responses import ResponsesEndpoints
810
from .tag1 import Tag1Endpoints
911
from .tests import TestsEndpoints
1012
from .true_ import True_Endpoints
@@ -15,6 +17,10 @@ class MyTestApiClientApi:
1517
def tests(cls) -> Type[TestsEndpoints]:
1618
return TestsEndpoints
1719

20+
@classmethod
21+
def responses(cls) -> Type[ResponsesEndpoints]:
22+
return ResponsesEndpoints
23+
1824
@classmethod
1925
def default(cls) -> Type[DefaultEndpoints]:
2026
return DefaultEndpoints
@@ -34,3 +40,7 @@ def location(cls) -> Type[LocationEndpoints]:
3440
@classmethod
3541
def true_(cls) -> Type[True_Endpoints]:
3642
return True_Endpoints
43+
44+
@classmethod
45+
def parameter_references(cls) -> Type[ParameterReferencesEndpoints]:
46+
return ParameterReferencesEndpoints
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 get_parameter_references_path_param
6+
7+
8+
class ParameterReferencesEndpoints:
9+
@classmethod
10+
def get_parameter_references_path_param(cls) -> types.ModuleType:
11+
"""
12+
Test different types of parameter references
13+
"""
14+
return get_parameter_references_path_param
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 post_responses_unions_simple_before_complex
6+
7+
8+
class ResponsesEndpoints:
9+
@classmethod
10+
def post_responses_unions_simple_before_complex(cls) -> types.ModuleType:
11+
"""
12+
Regression test for #603
13+
"""
14+
return post_responses_unions_simple_before_complex

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import types
44

55
from . import (
6+
callback_test,
67
defaults_tests_defaults_post,
78
get_basic_list_of_booleans,
89
get_basic_list_of_floats,
@@ -14,6 +15,7 @@
1415
no_response_tests_no_response_get,
1516
octet_stream_tests_octet_stream_get,
1617
post_form_data,
18+
post_form_data_inline,
1719
post_tests_json_body_string,
1820
test_inline_objects,
1921
token_with_cookie_auth_token_with_cookie_get,
@@ -66,6 +68,13 @@ def post_form_data(cls) -> types.ModuleType:
6668
"""
6769
return post_form_data
6870

71+
@classmethod
72+
def post_form_data_inline(cls) -> types.ModuleType:
73+
"""
74+
Post form data (inline schema)
75+
"""
76+
return post_form_data_inline
77+
6978
@classmethod
7079
def upload_file_tests_upload_post(cls) -> types.ModuleType:
7180
"""
@@ -142,3 +151,10 @@ def token_with_cookie_auth_token_with_cookie_get(cls) -> types.ModuleType:
142151
Test optional cookie parameters
143152
"""
144153
return token_with_cookie_auth_token_with_cookie_get
154+
155+
@classmethod
156+
def callback_test(cls) -> types.ModuleType:
157+
"""
158+
Try sending a request related to a callback
159+
"""
160+
return callback_test

end_to_end_tests/golden-record/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ dmypy.json
2020
.idea/
2121

2222
/coverage.xml
23-
/.coverage
23+
/.coverage

end_to_end_tests/golden-record/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,4 @@ If you want to install this client into another project without publishing it (e
8484
1. If that project **is using Poetry**, you can simply do `poetry add <path-to-this-client>` from that project
8585
1. If that project is not using Poetry:
8686
1. Build a wheel with `poetry build -f wheel`
87-
1. Install that wheel from the other project `pip install <path-to-wheel>`
87+
1. Install that wheel from the other project `pip install <path-to-wheel>`
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
""" A client library for accessing My Test API """
22
from .client import AuthenticatedClient, Client
3+
4+
__all__ = (
5+
"AuthenticatedClient",
6+
"Client",
7+
)

0 commit comments

Comments
 (0)