openapi-spec-tools 0.17.2__tar.gz → 0.18.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openapi_spec_tools-0.18.0/.gitignore +171 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/PKG-INFO +15 -17
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/README.md +1 -1
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli/arguments.py +1 -1
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli/layout.py +46 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/layout/merge.py +24 -1
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/layout/types.py +28 -4
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/layout/utils.py +102 -66
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/pyproject.toml +40 -29
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/LICENSE +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/__init__.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/api_gen/_environment.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/api_gen/api_generator.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/api_gen/files.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/api_gen/flat_generator.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/api_gen/opaque_generator.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/api_gen/property_generator.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/base_gen/_logging.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/base_gen/_requests.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/base_gen/base_generator.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/base_gen/constants.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/base_gen/files.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/base_gen/utils.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli/api_gen.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli/cli_gen.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli/history.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli/oas.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli/utils.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli_gen/_arguments.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli_gen/_display.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli_gen/_exceptions.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli_gen/_tree.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli_gen/cli_generator.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli_gen/constants.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli_gen/files.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/layout/layout_generator.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/types.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/utils.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/tests/cli_gen/__init__.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/tests/cli_gen/helpers.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/tests/cli_gen/test_cli_generator.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/tests/cli_gen/test_display.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/tests/cli_gen/test_exceptions.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/tests/cli_gen/test_files.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/tests/cli_gen/test_main.py +0 -0
- {openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/tests/cli_gen/test_tree.py +0 -0
|
@@ -0,0 +1,171 @@
|
|
|
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
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
|
|
110
|
+
# pdm
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
112
|
+
#pdm.lock
|
|
113
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
114
|
+
# in version control.
|
|
115
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
116
|
+
.pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
121
|
+
__pypackages__/
|
|
122
|
+
|
|
123
|
+
# Celery stuff
|
|
124
|
+
celerybeat-schedule
|
|
125
|
+
celerybeat.pid
|
|
126
|
+
|
|
127
|
+
# SageMath parsed files
|
|
128
|
+
*.sage.py
|
|
129
|
+
|
|
130
|
+
# Environments
|
|
131
|
+
.env
|
|
132
|
+
.venv
|
|
133
|
+
env/
|
|
134
|
+
venv/
|
|
135
|
+
ENV/
|
|
136
|
+
env.bak/
|
|
137
|
+
venv.bak/
|
|
138
|
+
|
|
139
|
+
# Spyder project settings
|
|
140
|
+
.spyderproject
|
|
141
|
+
.spyproject
|
|
142
|
+
|
|
143
|
+
# Rope project settings
|
|
144
|
+
.ropeproject
|
|
145
|
+
|
|
146
|
+
# mkdocs documentation
|
|
147
|
+
/site
|
|
148
|
+
|
|
149
|
+
# mypy
|
|
150
|
+
.mypy_cache/
|
|
151
|
+
.dmypy.json
|
|
152
|
+
dmypy.json
|
|
153
|
+
|
|
154
|
+
# Pyre type checker
|
|
155
|
+
.pyre/
|
|
156
|
+
|
|
157
|
+
# pytype static type analyzer
|
|
158
|
+
.pytype/
|
|
159
|
+
|
|
160
|
+
# Cython debug symbols
|
|
161
|
+
cython_debug/
|
|
162
|
+
|
|
163
|
+
# PyCharm
|
|
164
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
165
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
166
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
167
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
168
|
+
#.idea/
|
|
169
|
+
|
|
170
|
+
# PyPI configuration file
|
|
171
|
+
.pypirc
|
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: openapi-spec-tools
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.18.0
|
|
4
4
|
Summary: OpenAPI specification tools for analyzing, updating, and generating a CLI.
|
|
5
|
+
Project-URL: Homepage, https://github.com/rickwporter/openapi-spec-tools
|
|
6
|
+
Project-URL: Repository, https://github.com/rickwporter/openapi-spec-tools
|
|
7
|
+
Author-email: Rick Porter <rickwporter@gmail.com>
|
|
5
8
|
License-File: LICENSE
|
|
6
|
-
Author: Rick Porter
|
|
7
|
-
Author-email: rickwporter@gmail.com
|
|
8
|
-
Requires-Python: >=3.10,<4.0
|
|
9
9
|
Classifier: Development Status :: 4 - Beta
|
|
10
10
|
Classifier: Environment :: Console
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
13
13
|
Classifier: Programming Language :: Python
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
19
20
|
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
21
|
Classifier: Topic :: Software Development
|
|
22
22
|
Classifier: Topic :: Software Development :: Code Generators
|
|
23
23
|
Classifier: Topic :: Software Development :: Libraries
|
|
24
24
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
25
|
Classifier: Topic :: Utilities
|
|
26
26
|
Classifier: Typing :: Typed
|
|
27
|
-
Requires-
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
Requires-Dist:
|
|
32
|
-
Requires-Dist: rich-objects
|
|
33
|
-
Requires-Dist:
|
|
34
|
-
|
|
35
|
-
Project-URL: Repository, https://github.com/rickwporter/openapi-spec-tools
|
|
27
|
+
Requires-Python: <4,>=3.10
|
|
28
|
+
Requires-Dist: gitpython<4,>=3.1.59
|
|
29
|
+
Requires-Dist: pydantic<3,>=2.13.3
|
|
30
|
+
Requires-Dist: pyyaml<7,>=6.0.3
|
|
31
|
+
Requires-Dist: requests<3,>=2.33.1
|
|
32
|
+
Requires-Dist: rich-objects>=0.3.0
|
|
33
|
+
Requires-Dist: rich<16,>=15.0.0
|
|
34
|
+
Requires-Dist: typer>=0.27.2
|
|
36
35
|
Description-Content-Type: text/markdown
|
|
37
36
|
|
|
38
37
|
# openapi-spec-tools
|
|
@@ -44,7 +43,7 @@ This is a collection of tools for using OpenAPI specifications. The OpenAPI comm
|
|
|
44
43
|
The project has been published to PyPi, so you should be able to install it with something like one of the following (depending on how you do Python package management):
|
|
45
44
|
```terminal
|
|
46
45
|
% pip install openapi-spec-tools
|
|
47
|
-
%
|
|
46
|
+
% uv add openapi-spec-tools
|
|
48
47
|
```
|
|
49
48
|
|
|
50
49
|
Generally, there are two intended ways to utilize this package:
|
|
@@ -124,4 +123,3 @@ The `api-gen` tool allows users to generate API code using the OpenAPI spec. The
|
|
|
124
123
|
The [DEVELOPMENT.md](DEVELOPMENT.md) has more information about getting setup as a developer.
|
|
125
124
|
|
|
126
125
|
The [TODO.md](TODO.md) has some ideas where this project can be improved and expanded -- please add your ideas here, or email Rick directly (rickwporter@gmail.com).
|
|
127
|
-
|
|
@@ -7,7 +7,7 @@ This is a collection of tools for using OpenAPI specifications. The OpenAPI comm
|
|
|
7
7
|
The project has been published to PyPi, so you should be able to install it with something like one of the following (depending on how you do Python package management):
|
|
8
8
|
```terminal
|
|
9
9
|
% pip install openapi-spec-tools
|
|
10
|
-
%
|
|
10
|
+
% uv add openapi-spec-tools
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Generally, there are two intended ways to utilize this package:
|
|
@@ -93,7 +93,7 @@ OutputStyleOption = Annotated[
|
|
|
93
93
|
PackageNameArgument = Annotated[str, typer.Argument(metavar="PACKAGE", show_default=False, help="Base package name")]
|
|
94
94
|
PathPrefixOption = Annotated[
|
|
95
95
|
str,
|
|
96
|
-
typer.Option(metavar="PREFIX", show_default=False, help="Prefix to ignore when using path"),
|
|
96
|
+
typer.Option("--prefix", metavar="PREFIX", show_default=False, help="Prefix to ignore when using path"),
|
|
97
97
|
]
|
|
98
98
|
StartPointOption = Annotated[str, typer.Option("--start", metavar="START", help="Start point for CLI in layout file")]
|
|
99
99
|
UpdatedOpenApiFilenameOption = Annotated[
|
|
@@ -5,6 +5,7 @@ from typing import Annotated
|
|
|
5
5
|
|
|
6
6
|
import typer
|
|
7
7
|
import yaml
|
|
8
|
+
from pydantic import Field
|
|
8
9
|
from rich import print
|
|
9
10
|
from rich import print_json
|
|
10
11
|
from rich.table import Table
|
|
@@ -23,6 +24,7 @@ from openapi_spec_tools.cli.utils import open_oas_with_error_handling
|
|
|
23
24
|
from openapi_spec_tools.cli.utils import write_layout_tree
|
|
24
25
|
from openapi_spec_tools.layout.layout_generator import LayoutGenerator
|
|
25
26
|
from openapi_spec_tools.layout.merge import merge
|
|
27
|
+
from openapi_spec_tools.layout.merge import merge_node_properties
|
|
26
28
|
from openapi_spec_tools.layout.types import LayoutNode
|
|
27
29
|
from openapi_spec_tools.layout.utils import DEFAULT_START
|
|
28
30
|
from openapi_spec_tools.layout.utils import check_hardcoded
|
|
@@ -30,6 +32,7 @@ from openapi_spec_tools.layout.utils import check_pagination_definitions
|
|
|
30
32
|
from openapi_spec_tools.layout.utils import file_to_tree
|
|
31
33
|
from openapi_spec_tools.layout.utils import operation_duplicates
|
|
32
34
|
from openapi_spec_tools.layout.utils import operation_order
|
|
35
|
+
from openapi_spec_tools.layout.utils import subcommand_extra_properties
|
|
33
36
|
from openapi_spec_tools.layout.utils import subcommand_missing_properties
|
|
34
37
|
from openapi_spec_tools.layout.utils import subcommand_order
|
|
35
38
|
from openapi_spec_tools.layout.utils import subcommand_references
|
|
@@ -55,6 +58,7 @@ def layout_check_format(
|
|
|
55
58
|
references: Annotated[bool, typer.Option(help="Check for missing and unused subcommands")] = True,
|
|
56
59
|
sub_order: Annotated[bool, typer.Option(help="Check the sub-command order")] = True,
|
|
57
60
|
missing_props: Annotated[bool, typer.Option(help="Check for missing properties")] = True,
|
|
61
|
+
extra_props: Annotated[bool, typer.Option(help="Check for any extra properties")] = False,
|
|
58
62
|
op_dups: Annotated[bool, typer.Option(help="Check for duplicate names in sub-commands")] = True,
|
|
59
63
|
op_order: Annotated[bool, typer.Option(help="Check the operations order within each sub-command")] = True,
|
|
60
64
|
pagination: Annotated[bool, typer.Option(help="Check the pagination parameters for issues")] = True,
|
|
@@ -90,6 +94,12 @@ def layout_check_format(
|
|
|
90
94
|
typer.echo(f"Sub-commands have missing properties:{_dict_to_str(errors)}")
|
|
91
95
|
result = 1
|
|
92
96
|
|
|
97
|
+
if extra_props:
|
|
98
|
+
errors = subcommand_extra_properties(data)
|
|
99
|
+
if errors:
|
|
100
|
+
typer.echo(f"Commands have extra properties:{_dict_to_str(errors)}")
|
|
101
|
+
result = 1
|
|
102
|
+
|
|
93
103
|
if op_dups:
|
|
94
104
|
errors = operation_duplicates(data)
|
|
95
105
|
if errors:
|
|
@@ -235,5 +245,41 @@ def layout_suggest(
|
|
|
235
245
|
return
|
|
236
246
|
|
|
237
247
|
|
|
248
|
+
@app.command("merge", short_help="Merge properties between layouts")
|
|
249
|
+
def layout_merge(
|
|
250
|
+
source_file: Annotated[
|
|
251
|
+
str,
|
|
252
|
+
typer.Argument(metavar="SOURCE", show_default=False, help="Source layout file")
|
|
253
|
+
],
|
|
254
|
+
dest_file: Annotated[
|
|
255
|
+
str,
|
|
256
|
+
typer.Argument(metavar="DESTINATION", show_default=False, help="Destination layout file")
|
|
257
|
+
],
|
|
258
|
+
properties: Annotated[
|
|
259
|
+
list[str],
|
|
260
|
+
typer.Argument(metavar="PROPERTY...", help="List of properties to copy from source to destination"),
|
|
261
|
+
Field(min_length=1),
|
|
262
|
+
],
|
|
263
|
+
out_file: Annotated[
|
|
264
|
+
str | None,
|
|
265
|
+
typer.Option(metavar="OUT", help="Optional output layout file. Will reuse destination if not provided.")
|
|
266
|
+
] = None,
|
|
267
|
+
start: StartPointOption = DEFAULT_START,
|
|
268
|
+
indent: IndentOption = 4,
|
|
269
|
+
log_level: LogLevelOption = "info",
|
|
270
|
+
) -> None:
|
|
271
|
+
"""Merge properties from the source file into the destination file."""
|
|
272
|
+
logger = init_logging(log_level, LOG_CLASS)
|
|
273
|
+
source_node = layout_tree_with_error_handling(source_file, start=start, logger=logger)
|
|
274
|
+
dest_node = layout_tree_with_error_handling(dest_file, start=start, logger=logger)
|
|
275
|
+
|
|
276
|
+
result = merge_node_properties(properties, source_node, dest_node)
|
|
277
|
+
|
|
278
|
+
out_file = out_file or dest_file
|
|
279
|
+
write_layout_tree(out_file, result, logger, indent)
|
|
280
|
+
print(f"Wrote {out_file}")
|
|
281
|
+
return
|
|
282
|
+
|
|
283
|
+
|
|
238
284
|
if __name__ == "__main__":
|
|
239
285
|
app()
|
|
@@ -4,7 +4,7 @@ from copy import deepcopy
|
|
|
4
4
|
from openapi_spec_tools.layout.types import LayoutNode
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
def operations_to_node(node: LayoutNode) -> dict[str,
|
|
7
|
+
def operations_to_node(node: LayoutNode) -> dict[str, LayoutNode]:
|
|
8
8
|
"""Create map of operationId to parent LayoutNode."""
|
|
9
9
|
result = {node.identifier: node}
|
|
10
10
|
for child in node.children:
|
|
@@ -36,6 +36,29 @@ def find_peers(node: LayoutNode, op_id: str) -> list[str]:
|
|
|
36
36
|
return []
|
|
37
37
|
|
|
38
38
|
|
|
39
|
+
def merge_node_properties(properties: list[str], source: LayoutNode, destination: LayoutNode) -> LayoutNode:
|
|
40
|
+
"""Merge the specified properties from the original node (and sub-nodes) into the updated."""
|
|
41
|
+
# map operations to nodes
|
|
42
|
+
result = deepcopy(destination)
|
|
43
|
+
dst_ops = operations_to_node(result)
|
|
44
|
+
src_ops = operations_to_node(source)
|
|
45
|
+
|
|
46
|
+
# iterate across the operations
|
|
47
|
+
for name, dst_op in dst_ops.items():
|
|
48
|
+
src_op = src_ops.get(name)
|
|
49
|
+
if not src_op:
|
|
50
|
+
continue
|
|
51
|
+
|
|
52
|
+
# copy all properties for each node
|
|
53
|
+
for prop in properties:
|
|
54
|
+
if hasattr(src_op, prop):
|
|
55
|
+
setattr(dst_op, prop, getattr(src_op, prop))
|
|
56
|
+
elif prop in src_op.extra:
|
|
57
|
+
dst_op.extra[prop] = src_op.extra[prop]
|
|
58
|
+
|
|
59
|
+
return result
|
|
60
|
+
|
|
61
|
+
|
|
39
62
|
def merge(original: LayoutNode, suggested: LayoutNode) -> LayoutNode:
|
|
40
63
|
"""Merge data from suggested into original."""
|
|
41
64
|
updated = deepcopy(original)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"""Field enums and class definitions for objects used by the layout file."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
2
4
|
from enum import Enum
|
|
3
5
|
from typing import Any
|
|
4
6
|
from typing import Optional
|
|
@@ -7,15 +9,31 @@ from pydantic import BaseModel
|
|
|
7
9
|
from pydantic import Field
|
|
8
10
|
|
|
9
11
|
|
|
10
|
-
class
|
|
11
|
-
"""
|
|
12
|
+
class CommandField(str, Enum):
|
|
13
|
+
"""Top-level layout file fields."""
|
|
14
|
+
|
|
15
|
+
DESCRIPTION = "description"
|
|
16
|
+
OPERATIONS = "operations"
|
|
17
|
+
BUG_IDS = "bugIds"
|
|
18
|
+
|
|
19
|
+
@classmethod
|
|
20
|
+
def required(cls) -> list[CommandField]:
|
|
21
|
+
"""Layout command required fields."""
|
|
22
|
+
return [cls.DESCRIPTION, cls.OPERATIONS]
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def values(cls) -> set[str]:
|
|
26
|
+
"""Set of class member values."""
|
|
27
|
+
return cls._member_map_.values()
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class OperationField(str, Enum):
|
|
31
|
+
"""Layout file operation fields."""
|
|
12
32
|
|
|
13
33
|
NAME = "name"
|
|
14
34
|
BUG_IDS = "bugIds"
|
|
15
|
-
DESCRIPTION = "description"
|
|
16
35
|
HIDDEN_FIELDS = "hiddenFields"
|
|
17
36
|
OP_ID = "operationId"
|
|
18
|
-
OPERATIONS = "operations"
|
|
19
37
|
SUB_ID = "subcommandId"
|
|
20
38
|
SUMMARY_FIELDS = "summaryFields"
|
|
21
39
|
PAGINATION = "pagination"
|
|
@@ -25,6 +43,12 @@ class LayoutField(str, Enum):
|
|
|
25
43
|
REFERENCE = "reference"
|
|
26
44
|
HARDCODED = "hardCoded"
|
|
27
45
|
|
|
46
|
+
@classmethod
|
|
47
|
+
def values(cls) -> set[str]:
|
|
48
|
+
"""Set of class member values."""
|
|
49
|
+
return cls._member_map_.values()
|
|
50
|
+
|
|
51
|
+
|
|
28
52
|
|
|
29
53
|
class PaginationField(str, Enum):
|
|
30
54
|
"""Field names expected in the pagination parameters of the layout."""
|
|
@@ -5,16 +5,17 @@ from typing import Any
|
|
|
5
5
|
|
|
6
6
|
import yaml
|
|
7
7
|
|
|
8
|
+
from openapi_spec_tools.layout.types import CommandField
|
|
8
9
|
from openapi_spec_tools.layout.types import HardcodedField
|
|
9
|
-
from openapi_spec_tools.layout.types import LayoutField
|
|
10
10
|
from openapi_spec_tools.layout.types import LayoutNode
|
|
11
|
+
from openapi_spec_tools.layout.types import OperationField
|
|
11
12
|
from openapi_spec_tools.layout.types import PaginationField
|
|
12
13
|
from openapi_spec_tools.layout.types import PaginationNames
|
|
13
14
|
from openapi_spec_tools.layout.types import ReferenceField
|
|
14
15
|
from openapi_spec_tools.layout.types import ReferenceSubcommand
|
|
15
16
|
|
|
16
17
|
DEFAULT_START = "main"
|
|
17
|
-
ONE_OF = [
|
|
18
|
+
ONE_OF = [OperationField.OP_ID, OperationField.SUB_ID, OperationField.REFERENCE]
|
|
18
19
|
MISSING_ONE_OF = ", ".join(v.value for v in ONE_OF[:-1]) + f", or {ONE_OF[-1].value}"
|
|
19
20
|
|
|
20
21
|
|
|
@@ -44,13 +45,9 @@ def field_to_list(data: dict[str, Any], field: str) -> list[str]:
|
|
|
44
45
|
]
|
|
45
46
|
|
|
46
47
|
|
|
47
|
-
def parse_extras(data: dict[str, Any]) -> dict[str, Any]:
|
|
48
|
+
def parse_extras(data: dict[str, Any], allowed: set[str]) -> dict[str, Any]:
|
|
48
49
|
"""Pass through extra user data -- ignore the keys already in the LayoutFields."""
|
|
49
|
-
return {
|
|
50
|
-
k: v
|
|
51
|
-
for k, v in data.items()
|
|
52
|
-
if k not in [v.value for v in LayoutField]
|
|
53
|
-
}
|
|
50
|
+
return {k: v for k, v in data.items() if k not in allowed}
|
|
54
51
|
|
|
55
52
|
|
|
56
53
|
def path_to_parts(path_name: str, prefix: str) -> list[str]:
|
|
@@ -108,52 +105,66 @@ def parse_hardcoded(data: dict[str, Any] | None) -> dict[str, Any]:
|
|
|
108
105
|
return result
|
|
109
106
|
|
|
110
107
|
|
|
111
|
-
def
|
|
108
|
+
def parse_layout_operation(data: dict[str, Any], identifier: str, command: str, item: dict[str, Any]) -> LayoutNode:
|
|
109
|
+
"""Convert a leaf node into a LayoutNode."""
|
|
110
|
+
summary_fields = field_to_list(item, OperationField.SUMMARY_FIELDS)
|
|
111
|
+
hidden_fields = field_to_list(item, OperationField.HIDDEN_FIELDS)
|
|
112
|
+
allowed_fields = field_to_list(item, OperationField.ALLOWED_FIELDS)
|
|
113
|
+
columns = field_to_list(item, OperationField.COLUMNS)
|
|
114
|
+
pagination = parse_pagination(item.get(OperationField.PAGINATION))
|
|
115
|
+
ignore = item.get(OperationField.IGNORE)
|
|
116
|
+
reference = parse_reference(item.get(OperationField.REFERENCE))
|
|
117
|
+
hardcoded = parse_hardcoded(item.get(OperationField.HARDCODED))
|
|
118
|
+
bugs = field_to_list(item, OperationField.BUG_IDS)
|
|
119
|
+
extra = parse_extras(item, OperationField.values())
|
|
120
|
+
|
|
121
|
+
return LayoutNode(
|
|
122
|
+
command=command,
|
|
123
|
+
identifier=identifier,
|
|
124
|
+
description="",
|
|
125
|
+
bugs=bugs,
|
|
126
|
+
summary_fields=summary_fields,
|
|
127
|
+
hidden_fields=hidden_fields,
|
|
128
|
+
allowed_fields=allowed_fields,
|
|
129
|
+
display_columns=columns,
|
|
130
|
+
extra=extra,
|
|
131
|
+
pagination=pagination,
|
|
132
|
+
ignore=ignore,
|
|
133
|
+
reference=reference,
|
|
134
|
+
hardcoded=hardcoded,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def parse_layout_command(data: dict[str, Any], identifier: str, command: str, item: dict[str, Any]) -> LayoutNode:
|
|
112
139
|
"""Recursively convert elements from data to LayoutNodes."""
|
|
113
|
-
description = item.get(
|
|
140
|
+
description = item.get(CommandField.DESCRIPTION, "")
|
|
114
141
|
# identifier = item.get(LayoutField.OP_ID) or identifier
|
|
115
142
|
# parse bugs and summary fields into a list
|
|
116
|
-
bugs = field_to_list(item,
|
|
117
|
-
|
|
118
|
-
hidden_fields = field_to_list(item, LayoutField.HIDDEN_FIELDS)
|
|
119
|
-
allowed_fields = field_to_list(item, LayoutField.ALLOWED_FIELDS)
|
|
120
|
-
columns = field_to_list(item, LayoutField.COLUMNS)
|
|
121
|
-
extra = parse_extras(item)
|
|
122
|
-
pagination = parse_pagination(item.get(LayoutField.PAGINATION))
|
|
123
|
-
ignore = item.get(LayoutField.IGNORE)
|
|
124
|
-
reference = parse_reference(item.get(LayoutField.REFERENCE))
|
|
125
|
-
hardcoded = parse_hardcoded(item.get(LayoutField.HARDCODED))
|
|
143
|
+
bugs = field_to_list(item, CommandField.BUG_IDS)
|
|
144
|
+
extra = parse_extras(item, CommandField.values())
|
|
126
145
|
|
|
127
146
|
children = []
|
|
128
|
-
for op_data in item.get(
|
|
129
|
-
op_name = op_data.get(
|
|
130
|
-
sub_id = op_data.get(
|
|
147
|
+
for op_data in item.get(CommandField.OPERATIONS, []):
|
|
148
|
+
op_name = op_data.get(OperationField.NAME)
|
|
149
|
+
sub_id = op_data.get(OperationField.SUB_ID)
|
|
131
150
|
if sub_id:
|
|
132
151
|
# recursively go through this
|
|
133
|
-
subcommand =
|
|
134
|
-
subcommand.bugs.extend(field_to_list(op_data,
|
|
152
|
+
subcommand = parse_layout_command(data, sub_id, op_name, data.get(sub_id, {}))
|
|
153
|
+
subcommand.bugs.extend(field_to_list(op_data, CommandField.BUG_IDS))
|
|
135
154
|
children.append(subcommand)
|
|
136
155
|
continue
|
|
137
156
|
|
|
138
157
|
# use the current op-data to create a node -- it will be short
|
|
139
|
-
op_id = op_data.get(
|
|
140
|
-
children.append(
|
|
158
|
+
op_id = op_data.get(OperationField.OP_ID)
|
|
159
|
+
children.append(parse_layout_operation(data, op_id, op_name, op_data))
|
|
141
160
|
|
|
142
161
|
return LayoutNode(
|
|
143
162
|
command=command,
|
|
144
163
|
identifier=identifier,
|
|
145
164
|
description=description,
|
|
146
165
|
bugs=bugs,
|
|
147
|
-
summary_fields=summary_fields,
|
|
148
|
-
hidden_fields=hidden_fields,
|
|
149
|
-
allowed_fields=allowed_fields,
|
|
150
|
-
display_columns=columns,
|
|
151
166
|
extra=extra,
|
|
152
167
|
children=children,
|
|
153
|
-
pagination=pagination,
|
|
154
|
-
ignore=ignore,
|
|
155
|
-
reference=reference,
|
|
156
|
-
hardcoded=hardcoded,
|
|
157
168
|
)
|
|
158
169
|
|
|
159
170
|
|
|
@@ -163,7 +174,7 @@ def parse_to_tree(data: dict[str, Any], start: str = DEFAULT_START) -> LayoutNod
|
|
|
163
174
|
if not top:
|
|
164
175
|
raise ValueError(f"No start value found for '{start}'")
|
|
165
176
|
|
|
166
|
-
return
|
|
177
|
+
return parse_layout_command(data, start, start, top)
|
|
167
178
|
|
|
168
179
|
|
|
169
180
|
def subcommand_missing_properties(data: dict[str, Any]) -> dict[str, str]:
|
|
@@ -174,15 +185,15 @@ def subcommand_missing_properties(data: dict[str, Any]) -> dict[str, str]:
|
|
|
174
185
|
missing = []
|
|
175
186
|
|
|
176
187
|
# check top-level fields
|
|
177
|
-
for k in (
|
|
188
|
+
for k in CommandField.required():
|
|
178
189
|
if k not in sub_data:
|
|
179
190
|
missing.append(k)
|
|
180
191
|
|
|
181
192
|
# check each operations
|
|
182
|
-
for index, op_data in enumerate(sub_data.get(
|
|
183
|
-
identifier = op_data.get(
|
|
184
|
-
if
|
|
185
|
-
missing.append(f"{identifier} {
|
|
193
|
+
for index, op_data in enumerate(sub_data.get(CommandField.OPERATIONS, [])):
|
|
194
|
+
identifier = op_data.get(OperationField.NAME) or f"operation[{index}]"
|
|
195
|
+
if OperationField.NAME not in op_data:
|
|
196
|
+
missing.append(f"{identifier} {OperationField.NAME.value}")
|
|
186
197
|
if not any(p in op_data for p in ONE_OF):
|
|
187
198
|
missing.append(f"{identifier} {MISSING_ONE_OF}")
|
|
188
199
|
|
|
@@ -192,6 +203,31 @@ def subcommand_missing_properties(data: dict[str, Any]) -> dict[str, str]:
|
|
|
192
203
|
return errors
|
|
193
204
|
|
|
194
205
|
|
|
206
|
+
def subcommand_extra_properties(data: dict[str, Any]) -> dict[str, str]:
|
|
207
|
+
"""Look for missing properties in the sub-commands."""
|
|
208
|
+
errors = {}
|
|
209
|
+
commands = CommandField.values()
|
|
210
|
+
operations = OperationField.values()
|
|
211
|
+
for sub_name, _sub_data in data.items():
|
|
212
|
+
sub_data = deepcopy(_sub_data or {})
|
|
213
|
+
extra = []
|
|
214
|
+
|
|
215
|
+
# check top-level fields
|
|
216
|
+
extra.extend([k for k in sub_data.keys() if k not in commands])
|
|
217
|
+
|
|
218
|
+
# check each operations
|
|
219
|
+
for index, op_data in enumerate(sub_data.get(CommandField.OPERATIONS, [])):
|
|
220
|
+
op_extra = [k for k in op_data.keys() if k not in operations]
|
|
221
|
+
if op_extra:
|
|
222
|
+
identifier = op_data.get(OperationField.NAME) or f"operation[{index}]"
|
|
223
|
+
extra.append(f"{identifier}: {', '.join(op_extra)}")
|
|
224
|
+
|
|
225
|
+
if extra:
|
|
226
|
+
errors[sub_name] = ", ".join(extra)
|
|
227
|
+
|
|
228
|
+
return errors
|
|
229
|
+
|
|
230
|
+
|
|
195
231
|
def operation_duplicates(data: dict[str, Any]) -> dict[str, Any]:
|
|
196
232
|
"""Look for command operations with redundant names (within each command)."""
|
|
197
233
|
errors = {}
|
|
@@ -200,8 +236,8 @@ def operation_duplicates(data: dict[str, Any]) -> dict[str, Any]:
|
|
|
200
236
|
# check each operations
|
|
201
237
|
values = {}
|
|
202
238
|
sub_data = deepcopy(_sub_data or {})
|
|
203
|
-
for index, op_data in enumerate(sub_data.get(
|
|
204
|
-
name = op_data.get(
|
|
239
|
+
for index, op_data in enumerate(sub_data.get(CommandField.OPERATIONS, [])):
|
|
240
|
+
name = op_data.get(OperationField.NAME)
|
|
205
241
|
if not name:
|
|
206
242
|
continue
|
|
207
243
|
|
|
@@ -225,7 +261,7 @@ def operation_order(data: dict[str, Any]) -> dict[str, Any]:
|
|
|
225
261
|
|
|
226
262
|
for sub_name, _sub_data in data.items():
|
|
227
263
|
sub_data = deepcopy(_sub_data or {})
|
|
228
|
-
op_names = [op.get(
|
|
264
|
+
op_names = [op.get(OperationField.NAME) for op in sub_data.get(CommandField.OPERATIONS, [])]
|
|
229
265
|
if op_names != sorted(op_names):
|
|
230
266
|
errors[sub_name] = ", ".join(sorted(op_names))
|
|
231
267
|
|
|
@@ -238,9 +274,9 @@ def subcommand_references(data: dict[str, Any], start: str = DEFAULT_START) -> t
|
|
|
238
274
|
for _sub_data in data.values():
|
|
239
275
|
sub_data = deepcopy(_sub_data or {})
|
|
240
276
|
refs = [
|
|
241
|
-
op.get(
|
|
242
|
-
for op in sub_data.get(
|
|
243
|
-
if op.get(
|
|
277
|
+
op.get(OperationField.SUB_ID)
|
|
278
|
+
for op in sub_data.get(CommandField.OPERATIONS, [])
|
|
279
|
+
if op.get(OperationField.SUB_ID)
|
|
244
280
|
]
|
|
245
281
|
referenced.update(refs)
|
|
246
282
|
|
|
@@ -285,8 +321,8 @@ def check_pagination_definitions(data: dict[str, Any]) -> dict[str, str]:
|
|
|
285
321
|
|
|
286
322
|
for sub_name, _sub_data in data.items():
|
|
287
323
|
sub_data = deepcopy(_sub_data or {})
|
|
288
|
-
for op in sub_data.get(
|
|
289
|
-
page_params = op.get(
|
|
324
|
+
for op in sub_data.get(CommandField.OPERATIONS, []):
|
|
325
|
+
page_params = op.get(OperationField.PAGINATION)
|
|
290
326
|
if not page_params:
|
|
291
327
|
continue
|
|
292
328
|
|
|
@@ -301,7 +337,7 @@ def check_pagination_definitions(data: dict[str, Any]) -> dict[str, str]:
|
|
|
301
337
|
reasons.append("start can only be specified with page or item paramter")
|
|
302
338
|
|
|
303
339
|
if reasons:
|
|
304
|
-
full_name = f"{sub_name}.{op.get(
|
|
340
|
+
full_name = f"{sub_name}.{op.get(OperationField.NAME)}"
|
|
305
341
|
errors[full_name] = '; '.join(reasons)
|
|
306
342
|
|
|
307
343
|
return errors
|
|
@@ -315,12 +351,12 @@ def check_hardcoded(data: dict[str, Any]) -> dict[str, str]:
|
|
|
315
351
|
|
|
316
352
|
for sub_name, _sub_data in data.items():
|
|
317
353
|
sub_data = _sub_data or {}
|
|
318
|
-
for op_data in sub_data.get(
|
|
319
|
-
hard_params = op_data.get(
|
|
354
|
+
for op_data in sub_data.get(CommandField.OPERATIONS, []):
|
|
355
|
+
hard_params = op_data.get(OperationField.HARDCODED)
|
|
320
356
|
if not hard_params:
|
|
321
357
|
continue
|
|
322
358
|
|
|
323
|
-
full_name = f"{sub_name}.{op_data.get(
|
|
359
|
+
full_name = f"{sub_name}.{op_data.get(OperationField.NAME)}"
|
|
324
360
|
if not isinstance(hard_params, list):
|
|
325
361
|
errors[full_name] = "must be a list of parameter name/values"
|
|
326
362
|
continue
|
|
@@ -380,36 +416,36 @@ def layout_node_to_dict(node: LayoutNode) -> dict[str, Any]:
|
|
|
380
416
|
"""Convert LayoutNode to a dictionary for output."""
|
|
381
417
|
operations = []
|
|
382
418
|
for child in sorted(node.children, key=lambda x: x.command):
|
|
383
|
-
flavor =
|
|
419
|
+
flavor = OperationField.OP_ID.value if not child.children else OperationField.SUB_ID.value
|
|
384
420
|
op_data = {
|
|
385
|
-
|
|
421
|
+
OperationField.NAME.value: child.command,
|
|
386
422
|
}
|
|
387
423
|
if not child.reference:
|
|
388
424
|
op_data[flavor] = child.identifier
|
|
389
425
|
if child.ignore:
|
|
390
|
-
op_data[
|
|
426
|
+
op_data[OperationField.IGNORE.value] = True
|
|
391
427
|
if child.bugs:
|
|
392
|
-
op_data[
|
|
428
|
+
op_data[CommandField.BUG_IDS.value] = child.bugs
|
|
393
429
|
if child.allowed_fields:
|
|
394
|
-
op_data[
|
|
430
|
+
op_data[OperationField.ALLOWED_FIELDS.value] = child.allowed_fields
|
|
395
431
|
if child.hidden_fields:
|
|
396
|
-
op_data[
|
|
432
|
+
op_data[OperationField.HIDDEN_FIELDS.value] = child.hidden_fields
|
|
397
433
|
if child.summary_fields:
|
|
398
|
-
op_data[
|
|
434
|
+
op_data[OperationField.SUMMARY_FIELDS.value] = child.summary_fields
|
|
399
435
|
if child.display_columns:
|
|
400
|
-
op_data[
|
|
436
|
+
op_data[OperationField.COLUMNS.value] = child.display_columns
|
|
401
437
|
if child.pagination:
|
|
402
|
-
op_data[
|
|
438
|
+
op_data[OperationField.PAGINATION.value] = pagination_to_dict(child.pagination)
|
|
403
439
|
if child.reference:
|
|
404
|
-
op_data[
|
|
440
|
+
op_data[OperationField.REFERENCE.value] = reference_to_dict(child.reference)
|
|
405
441
|
if child.hardcoded:
|
|
406
|
-
op_data[
|
|
442
|
+
op_data[OperationField.HARDCODED.value] = dict(sorted(child.hardcoded.items()))
|
|
407
443
|
operations.append(op_data)
|
|
408
444
|
|
|
409
445
|
result = {
|
|
410
446
|
node.identifier: {
|
|
411
|
-
|
|
412
|
-
|
|
447
|
+
CommandField.DESCRIPTION.value: node.description,
|
|
448
|
+
CommandField.OPERATIONS.value: operations,
|
|
413
449
|
},
|
|
414
450
|
}
|
|
415
451
|
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
[
|
|
1
|
+
[project]
|
|
2
2
|
name = "openapi-spec-tools"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.18.0"
|
|
4
4
|
description = "OpenAPI specification tools for analyzing, updating, and generating a CLI."
|
|
5
|
-
authors = ["Rick Porter
|
|
5
|
+
authors = [{ name = "Rick Porter", email = "rickwporter@gmail.com" }]
|
|
6
|
+
requires-python = ">=3.10,<4"
|
|
6
7
|
readme = "README.md"
|
|
7
|
-
# NOTE: including all cli_gen tests... some are copied when generating code with tests
|
|
8
|
-
include = [
|
|
9
|
-
{ path = "tests/cli_gen", format = ["sdist", "wheel"] },
|
|
10
|
-
]
|
|
11
8
|
classifiers = [
|
|
12
9
|
"Development Status :: 4 - Beta",
|
|
13
10
|
"Environment :: Console",
|
|
@@ -28,33 +25,51 @@ classifiers = [
|
|
|
28
25
|
"Typing :: Typed",
|
|
29
26
|
"Topic :: Utilities",
|
|
30
27
|
]
|
|
28
|
+
dependencies = [
|
|
29
|
+
"pyyaml>=6.0.3,<7",
|
|
30
|
+
"typer>=0.27.2",
|
|
31
|
+
"rich>=15.0.0,<16",
|
|
32
|
+
"requests>=2.33.1,<3",
|
|
33
|
+
"pydantic>=2.13.3,<3",
|
|
34
|
+
"rich-objects>=0.3.0",
|
|
35
|
+
"gitpython>=3.1.59,<4",
|
|
36
|
+
]
|
|
31
37
|
|
|
32
|
-
[
|
|
38
|
+
[project.urls]
|
|
33
39
|
Homepage = "https://github.com/rickwporter/openapi-spec-tools"
|
|
34
40
|
Repository = "https://github.com/rickwporter/openapi-spec-tools"
|
|
35
41
|
|
|
36
|
-
[
|
|
37
|
-
python = "^3.10"
|
|
38
|
-
pyyaml = "^6.0.3"
|
|
39
|
-
typer = "^0.24.2"
|
|
40
|
-
rich = "^14.3.3"
|
|
41
|
-
requests = "^2.33.1"
|
|
42
|
-
pydantic = "^2.13.3"
|
|
43
|
-
rich-objects = "^0.2.3"
|
|
44
|
-
gitpython = "^3.1.59"
|
|
45
|
-
|
|
46
|
-
[tool.poetry.scripts]
|
|
42
|
+
[project.scripts]
|
|
47
43
|
oas = "openapi_spec_tools.cli.oas:app"
|
|
48
44
|
cli-gen = "openapi_spec_tools.cli.cli_gen:app"
|
|
49
45
|
api-gen = "openapi_spec_tools.cli.api_gen:app"
|
|
50
46
|
layout = "openapi_spec_tools.cli.layout:app"
|
|
51
47
|
|
|
52
|
-
[
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
[dependency-groups]
|
|
49
|
+
dev = [
|
|
50
|
+
"pytest>=9.0.2,<10",
|
|
51
|
+
"ruff>=0.15.6,<0.16",
|
|
52
|
+
"black>=26.3.1,<27",
|
|
53
|
+
"coverage>=7.13.4,<8",
|
|
54
|
+
"tomlkit>=0.13.3,<0.14",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[tool.uv]
|
|
58
|
+
default-groups = "all"
|
|
59
|
+
|
|
60
|
+
# NOTE: including cli_gen tests... some are copied when generating code with tests
|
|
61
|
+
[tool.hatch.build.targets.sdist]
|
|
62
|
+
only-include = [
|
|
63
|
+
"openapi_spec_tools",
|
|
64
|
+
"tests/cli_gen",
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
[tool.hatch.build.targets.wheel.force-include]
|
|
68
|
+
"tests/cli_gen" = "tests/cli_gen"
|
|
69
|
+
|
|
70
|
+
[build-system]
|
|
71
|
+
requires = ["hatchling"]
|
|
72
|
+
build-backend = "hatchling.build"
|
|
58
73
|
|
|
59
74
|
[tool.ruff]
|
|
60
75
|
line-length = 120
|
|
@@ -128,7 +143,3 @@ exclude_lines = [
|
|
|
128
143
|
"@overload",
|
|
129
144
|
'if __name__ == "__main__":',
|
|
130
145
|
]
|
|
131
|
-
|
|
132
|
-
[build-system]
|
|
133
|
-
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
134
|
-
build-backend = "poetry.core.masonry.api"
|
|
File without changes
|
|
File without changes
|
{openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/api_gen/_environment.py
RENAMED
|
File without changes
|
{openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/api_gen/api_generator.py
RENAMED
|
File without changes
|
|
File without changes
|
{openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/api_gen/flat_generator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/base_gen/_logging.py
RENAMED
|
File without changes
|
{openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/base_gen/_requests.py
RENAMED
|
File without changes
|
|
File without changes
|
{openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/base_gen/constants.py
RENAMED
|
File without changes
|
{openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/base_gen/files.py
RENAMED
|
File without changes
|
{openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/base_gen/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli_gen/_arguments.py
RENAMED
|
File without changes
|
{openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli_gen/_display.py
RENAMED
|
File without changes
|
{openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli_gen/_exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
{openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli_gen/cli_generator.py
RENAMED
|
File without changes
|
{openapi_spec_tools-0.17.2 → openapi_spec_tools-0.18.0}/openapi_spec_tools/cli_gen/constants.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|