Skip to content

Commit adfe92b

Browse files
committed
Adds samples and readme
1 parent 54940d4 commit adfe92b

File tree

519 files changed

+43065
-0
lines changed

Some content is hidden

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

519 files changed

+43065
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,49 @@
11
# openapi-python-client-comparison
22
openapi python client comparison
3+
4+
A repo to compare openapi python clients
5+
6+
## Implementations Included
7+
- [swagger-codegen](https://github.com/swagger-api/swagger-codegen), python generator
8+
- [openapi-generator](https://github.com/OpenAPITools/openapi-generator)
9+
- python-prior generator
10+
- python-nextgen
11+
- [openapi-json-schema-generator](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator), python generator
12+
13+
## Openapi Documents and Purposes
14+
15+
| Document | Purpose | Provenance |
16+
| -------- | ------- | ---------- |
17+
| petstore.yaml | standard api | [openapi-generator repo](https://github.com/OpenAPITools/openapi-generator/blob/917892db7d1dc5a459bdf6d499a491367fc97751/modules/openapi-generator/src/test/resources/3_0/petstore.yaml)
18+
19+
## Generated Code Amount
20+
via vscode code counter tool
21+
22+
### petstore.yaml
23+
24+
| Language | Files | % | Code | % | Comment | % |
25+
| -------- | ----- | - | ---- | - | ------- | - |
26+
| openapi_generator_python_prior | 45 | 100.0 | 4637 | 42.7 | 3371 | 31.1 |
27+
28+
29+
## Generate
30+
31+
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli:2.4.31 generate \
32+
-i /local/petstore.yaml \
33+
-l python \
34+
-o /local/swagger_codegen_python
35+
36+
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v6.5.0 generate \
37+
-i /local/petstore.yaml \
38+
-g python-prior \
39+
-o /local/openapi_generator_python_prior
40+
41+
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v6.5.0 generate \
42+
-i /local/petstore.yaml \
43+
-g python-nextgen \
44+
-o /local/openapi_generator_python_nextgen
45+
46+
docker run --rm -v "${PWD}:/local" openapjsonschematools/openapi-json-schema-generator-cli:2.0.0 generate \
47+
-i /local/petstore.yaml \
48+
-g python \
49+
-o /local/openapi_json_schema_generator_python
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# NOTE: This file is auto generated by OpenAPI Generator.
2+
# URL: https://openapi-generator.tech
3+
#
4+
# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
5+
6+
name: openapi_client Python package
7+
8+
on: [push, pull_request]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.7", "3.8", "3.9", "3.10"]
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install flake8 pytest
28+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
29+
- name: Lint with flake8
30+
run: |
31+
# stop the build if there are Python syntax errors or undefined names
32+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
33+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
34+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
35+
- name: Test with pytest
36+
run: |
37+
pytest
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
27+
# PyInstaller
28+
# Usually these files are written by a python script from a template
29+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.coverage
41+
.coverage.*
42+
.cache
43+
nosetests.xml
44+
coverage.xml
45+
*,cover
46+
.hypothesis/
47+
venv/
48+
.venv/
49+
.python-version
50+
.pytest_cache
51+
52+
# Translations
53+
*.mo
54+
*.pot
55+
56+
# Django stuff:
57+
*.log
58+
59+
# Sphinx documentation
60+
docs/_build/
61+
62+
# PyBuilder
63+
target/
64+
65+
#Ipython Notebook
66+
.ipynb_checkpoints
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# NOTE: This file is auto generated by OpenAPI Generator.
2+
# URL: https://openapi-generator.tech
3+
#
4+
# ref: https://docs.gitlab.com/ee/ci/README.html
5+
# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml
6+
7+
stages:
8+
- test
9+
10+
.pytest:
11+
stage: test
12+
script:
13+
- pip install -r requirements.txt
14+
- pip install -r test-requirements.txt
15+
- pytest --cov=openapi_client
16+
17+
pytest-3.7:
18+
extends: .pytest
19+
image: python:3.7-alpine
20+
pytest-3.8:
21+
extends: .pytest
22+
image: python:3.8-alpine
23+
pytest-3.9:
24+
extends: .pytest
25+
image: python:3.9-alpine
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.github/workflows/python.yml
2+
.gitignore
3+
.gitlab-ci.yml
4+
.openapi-generator-ignore
5+
.travis.yml
6+
README.md
7+
docs/ApiResponse.md
8+
docs/Category.md
9+
docs/Order.md
10+
docs/Pet.md
11+
docs/PetApi.md
12+
docs/StoreApi.md
13+
docs/Tag.md
14+
docs/User.md
15+
docs/UserApi.md
16+
git_push.sh
17+
openapi_client/__init__.py
18+
openapi_client/api/__init__.py
19+
openapi_client/api/pet_api.py
20+
openapi_client/api/store_api.py
21+
openapi_client/api/user_api.py
22+
openapi_client/api_client.py
23+
openapi_client/configuration.py
24+
openapi_client/exceptions.py
25+
openapi_client/models/__init__.py
26+
openapi_client/models/api_response.py
27+
openapi_client/models/category.py
28+
openapi_client/models/order.py
29+
openapi_client/models/pet.py
30+
openapi_client/models/tag.py
31+
openapi_client/models/user.py
32+
openapi_client/rest.py
33+
pyproject.toml
34+
requirements.txt
35+
setup.cfg
36+
setup.py
37+
test-requirements.txt
38+
test/__init__.py
39+
test/test_api_response.py
40+
test/test_category.py
41+
test/test_order.py
42+
test/test_pet.py
43+
test/test_pet_api.py
44+
test/test_store_api.py
45+
test/test_tag.py
46+
test/test_user.py
47+
test/test_user_api.py
48+
tox.ini
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.5.0
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ref: https://docs.travis-ci.com/user/languages/python
2+
language: python
3+
python:
4+
- "3.7"
5+
- "3.8"
6+
- "3.9"
7+
- "3.10"
8+
- "3.11"
9+
# uncomment the following if needed
10+
#- "3.11-dev" # 3.11 development branch
11+
#- "nightly" # nightly build
12+
# command to install dependencies
13+
install:
14+
- "pip install -r requirements.txt"
15+
- "pip install -r test-requirements.txt"
16+
# command to run tests
17+
script: pytest --cov=openapi_client

0 commit comments

Comments
 (0)