Skip to content

Commit 8daa65d

Browse files
committed
Merge branch 'main' into add_option_to_not_prepend_title_model_classes_with_fullpaths
2 parents 58c6eaf + dd81e19 commit 8daa65d

File tree

187 files changed

+7908
-1591
lines changed

Some content is hidden

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

187 files changed

+7908
-1591
lines changed

.flake8

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

.github/check_for_changes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import subprocess
2+
3+
output = subprocess.run(["git", "status", "--porcelain"], capture_output=True, check=True).stdout
4+
5+
if output == b"":
6+
# No changes
7+
exit(0)
8+
9+
print(output)
10+
exit(1)

.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: 58 additions & 8 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:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v3
1818
- name: Set up Python
19-
uses: actions/setup-python@v2
19+
uses: actions/setup-python@v4
2020
with:
2121
python-version: ${{ matrix.python }}
2222

@@ -25,7 +25,7 @@ jobs:
2525
run: echo "::set-output name=python_version::$(python --version)"
2626

2727
- name: Cache dependencies
28-
uses: actions/cache@v2
28+
uses: actions/cache@v3
2929
with:
3030
path: .venv
3131
key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/poetry.lock') }}
@@ -49,9 +49,6 @@ jobs:
4949
- name: Run isort
5050
run: poetry run isort . --check
5151

52-
- name: Run flake8
53-
run: poetry run flake8 openapi_python_client
54-
5552
- name: Run safety
5653
run: poetry export -f requirements.txt | poetry run safety check --bare --stdin
5754

@@ -70,6 +67,59 @@ jobs:
7067
shell: bash
7168
run: poetry run coverage xml
7269

73-
- uses: codecov/codecov-action@v2
70+
- uses: codecov/codecov-action@v3
7471
with:
7572
files: ./coverage.xml
73+
74+
integration:
75+
name: Integration Tests
76+
runs-on: ubuntu-latest
77+
services:
78+
openapi-test-server:
79+
image: ghcr.io/openapi-generators/openapi-test-server:0.0.1
80+
ports:
81+
- "3000:3000"
82+
steps:
83+
- uses: actions/checkout@v3
84+
- name: Set up Python
85+
uses: actions/setup-python@v4
86+
with:
87+
python-version: "3.10"
88+
- name: Get Python Version
89+
id: get_python_version
90+
run: echo "::set-output name=python_version::$(python --version)"
91+
- name: Cache dependencies
92+
uses: actions/cache@v3
93+
with:
94+
path: .venv
95+
key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/poetry.lock') }}
96+
restore-keys: |
97+
${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies
98+
- name: Install dependencies
99+
run: |
100+
pip install poetry
101+
python -m venv .venv
102+
poetry run python -m pip install --upgrade pip
103+
poetry install
104+
- name: Regenerate Integration Client
105+
run: |
106+
poetry run openapi-python-client update --url http://localhost:3000/openapi.json --config integration-tests-config.yaml
107+
- name: Check for any file changes
108+
run: python .github/check_for_changes.py
109+
- name: Cache Generated Client Dependencies
110+
uses: actions/cache@v3
111+
with:
112+
path: integration-tests/.venv
113+
key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies-${{ hashFiles('**/poetry.lock') }}
114+
restore-keys: |
115+
${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies
116+
- name: Install Integration Dependencies
117+
run: |
118+
cd integration-tests
119+
python -m venv .venv
120+
poetry run python -m pip install --upgrade pip
121+
poetry install
122+
- name: Run Tests
123+
run: |
124+
cd integration-tests
125+
poetry run pytest

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
steps:
1818
- name: Checkout repository
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v3
2020
with:
2121
# We must fetch at least the immediate parents so that if this is
2222
# a pull request then we can checkout the head.
@@ -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: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,127 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
Breaking changes to any of the following will cause the **minor** version to be incremented (as long as this project is 0.x). Only these pieces are considered part of the public API:
8+
9+
- The _behavior_ of the generated code. Specifically, the way in which generated endpoints and classes are called and the way in which those calls communicate with an OpenAPI server. Any other property of the generated code is not considered part of the versioned, public API (e.g., code formatting, comments).
10+
- The invocation of the CLI (e.g., commands or arguments).
11+
12+
Programmatic usage of this project (e.g., importing it as a Python module) and the usage of custom templates are not considered part of the public API and therefore may change behavior at any time without notice.
13+
14+
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).
15+
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+
90+
## 0.11.1
91+
92+
### Features
93+
94+
- Allow httpx 0.22.\* (#577)
95+
96+
### Fixes
97+
98+
- Type annotations for optional dates and datetimes in multipart/form (#580)
99+
- Error generating clients with dates or datetimes in multipart/form [#579]. Thanks @lsaavedr!
100+
- Include nested packages in generated setup.py [#575, #576]. Thanks @tedo-benchling!
101+
102+
## 0.11.0
103+
104+
### Breaking Changes
105+
106+
- Minimum required `attrs` version in generated clients is now 21.3.0.
107+
- Python 3.6 is officially not supported. The minimum version has been updated to reflect this.
108+
- Validation of OpenAPI documents is now more strict.
109+
- Model names generated from OpenAPI names with periods (`.`) in them will be different.
110+
- Header values will be explicitly transformed or omitted instead of blindly passed to httpx as-is.
111+
- `datetime` is now considered a reserved word everywhere, so any properties which were named `datetime` will now be named `datetime_`.
112+
- `File` uploads can now only accept binary payloads (`BinaryIO`).
113+
114+
### Features
115+
116+
- Don't set a cap on allowed `attrs` version.
117+
- use poetry-core as build backend in generated clients [#565]. Thanks @fabaff!
118+
- Use httpx.request to allow bodies for all type of requests [#545, #547]. Thanks @MalteBecker!
119+
120+
### Fixes
121+
122+
- OpenAPI schema validation issues (#426, #568). Thanks @p1-ra!
123+
- treat period as a delimiter in names (#546). Thanks @alexifm!
124+
- Non-string header values [#552, #553, #566]. Thanks @John98Zakaria!
125+
- Generate valid code when a property of a model is named "datetime" [#557 & #558]. Thanks @kmray!
126+
- Multipart uploads for httpx >= 0.19.0 [#508, #548]. Thanks @skuo1-ilmn & @kairntech!
127+
7128
## 0.10.8
8129

9130
### Features

CONTRIBUTING.md

Lines changed: 8 additions & 7 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

@@ -21,17 +21,18 @@
2121

2222
2. When in a Poetry shell (`poetry shell`) run `task check` in order to run most of the same checks CI runs. This will auto-reformat the code, check type annotations, run unit tests, check code coverage, and lint the code.
2323

24-
### Rework end to end tests
24+
### Rework end-to-end tests
2525

26-
3. If you're writing a new feature, try to add it to the end to end test.
26+
3. If you're writing a new feature, try to add it to the end-to-end test.
2727
1. If adding support for a new OpenAPI feature, add it somewhere in `end_to_end_tests/openapi.json`
28-
2. Regenerate the "golden records" with `task regen`. This client is generated from the OpenAPI document used for end to end testing.
28+
2. Regenerate the "golden records" with `task regen`. This client is generated from the OpenAPI document used for end-to-end testing.
2929
3. Check the changes to `end_to_end_tests/golden-record` to confirm only what you intended to change did change and that the changes look correct.
30-
4. Run the end to end tests with `task e2e`. This will generate clients against `end_to_end_tests/openapi.json` and compare them with the golden record. The tests will fail if **anything is different**. The end to end tests are not included in `task check` as they take longer to run and don't provide very useful feedback in the event of failure. If an e2e test does fail, the easiest way to check what's wrong is to run `task regen` and check the diffs. You can also use `task re` which will run `regen` and `e2e` in that order.
30+
4. **If you added a test above OR modified the templates**: Run the end-to-end tests with `task e2e`. This will generate clients against `end_to_end_tests/openapi.json` and compare them with the golden record. The tests will fail if **anything is different**. The end-to-end tests are not included in `task check` as they take longer to run and don't provide very useful feedback in the event of failure. If an e2e test does fail, the easiest way to check what's wrong is to run `task regen` and check the diffs. You can also use `task re` which will run `regen` and `e2e` in that order.
31+
3132

3233
## Creating a Pull Request
3334

34-
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:
3536

3637
- feat: Support for `allOf` in OpenAPI documents (closes #123).
3738
- refactor!: Removed support for Python 3.5
@@ -44,4 +45,4 @@ Once your PR is created, a series of automated checks should run. If any of them
4445
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.
4546

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

0 commit comments

Comments
 (0)