openapi-client-codegen 0.1.10__py3-none-any.whl → 0.1.12__py3-none-any.whl
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_client_codegen/cli.py +3 -3
- openapi_client_codegen/orchestrator.py +25 -1
- {openapi_client_codegen-0.1.10.dist-info → openapi_client_codegen-0.1.12.dist-info}/METADATA +3 -1
- {openapi_client_codegen-0.1.10.dist-info → openapi_client_codegen-0.1.12.dist-info}/RECORD +8 -8
- {openapi_client_codegen-0.1.10.dist-info → openapi_client_codegen-0.1.12.dist-info}/WHEEL +0 -0
- {openapi_client_codegen-0.1.10.dist-info → openapi_client_codegen-0.1.12.dist-info}/entry_points.txt +0 -0
- {openapi_client_codegen-0.1.10.dist-info → openapi_client_codegen-0.1.12.dist-info}/licenses/LICENSE +0 -0
- {openapi_client_codegen-0.1.10.dist-info → openapi_client_codegen-0.1.12.dist-info}/licenses/NOTICE +0 -0
openapi_client_codegen/cli.py
CHANGED
|
@@ -7,7 +7,7 @@ from typer import Option, Typer
|
|
|
7
7
|
|
|
8
8
|
from .client import generate_client
|
|
9
9
|
from .downgrade import downgrade_openapi_3_1_to_3_0
|
|
10
|
-
from .orchestrator import ClientNaming,
|
|
10
|
+
from .orchestrator import ClientNaming, SpecProducer, load_config
|
|
11
11
|
from .templates import regenerate_templates
|
|
12
12
|
|
|
13
13
|
app = Typer(pretty_exceptions_show_locals=False)
|
|
@@ -16,7 +16,7 @@ app = Typer(pretty_exceptions_show_locals=False)
|
|
|
16
16
|
@app.command()
|
|
17
17
|
def generate_projects_command(
|
|
18
18
|
config: Annotated[
|
|
19
|
-
Path, Option(help="
|
|
19
|
+
Path, Option(help="YAML config carrying the projects mapping, the client identity, and the spec command")
|
|
20
20
|
],
|
|
21
21
|
project: Annotated[str | None, Option(help="Generate only this project, as keyed in the config")] = None,
|
|
22
22
|
client: Annotated[str | None, Option(help="Generate only this client generator")] = None,
|
|
@@ -25,7 +25,7 @@ def generate_projects_command(
|
|
|
25
25
|
] = False,
|
|
26
26
|
root: Annotated[Path, Option(help="Repository root the project paths resolve against")] = Path(),
|
|
27
27
|
) -> None:
|
|
28
|
-
settings =
|
|
28
|
+
settings = load_config(config)
|
|
29
29
|
root = root.resolve()
|
|
30
30
|
dump_spec = SpecProducer(settings.spec_command, env=settings.spec_env)
|
|
31
31
|
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import importlib.metadata
|
|
3
4
|
from dataclasses import dataclass
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
|
|
6
7
|
from bashrun.bash import bash_output
|
|
7
|
-
from
|
|
8
|
+
from packaging.specifiers import SpecifierSet
|
|
9
|
+
from pydantic import BaseModel, ConfigDict, field_validator
|
|
10
|
+
from strictyaml import load as load_strict_yaml
|
|
11
|
+
|
|
12
|
+
DEV_SENTINEL = "0.0.0.dev0"
|
|
8
13
|
|
|
9
14
|
|
|
10
15
|
class ProjectsConfig(BaseModel):
|
|
@@ -18,6 +23,15 @@ class ProjectsConfig(BaseModel):
|
|
|
18
23
|
npm_scope: str | None = None
|
|
19
24
|
license_spdx: str | None = None
|
|
20
25
|
repository_url: str | None = None
|
|
26
|
+
requires: str
|
|
27
|
+
|
|
28
|
+
@field_validator("requires")
|
|
29
|
+
@classmethod
|
|
30
|
+
def validate_requires(cls, value: str) -> str:
|
|
31
|
+
if not value:
|
|
32
|
+
raise ValueError("requires must be a non-empty PEP 440 specifier; use '>=0.0' for no constraint")
|
|
33
|
+
SpecifierSet(value)
|
|
34
|
+
return value
|
|
21
35
|
|
|
22
36
|
|
|
23
37
|
@dataclass(frozen=True)
|
|
@@ -35,3 +49,13 @@ class SpecProducer:
|
|
|
35
49
|
|
|
36
50
|
def __call__(self, project: Path) -> str:
|
|
37
51
|
return bash_output(self.command, cwd=project, env=self.env)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def load_config(path: Path) -> ProjectsConfig:
|
|
55
|
+
config = ProjectsConfig.model_validate(load_strict_yaml(path.read_text(encoding="utf-8")).data)
|
|
56
|
+
installed = importlib.metadata.version("openapi-client-codegen")
|
|
57
|
+
if installed == DEV_SENTINEL:
|
|
58
|
+
return config
|
|
59
|
+
if not SpecifierSet(config.requires).contains(installed, prereleases=True):
|
|
60
|
+
raise SystemExit(f"openapi-client-codegen {installed} does not satisfy requires={config.requires!r}")
|
|
61
|
+
return config
|
{openapi_client_codegen-0.1.10.dist-info → openapi_client_codegen-0.1.12.dist-info}/METADATA
RENAMED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: openapi-client-codegen
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.12
|
|
4
4
|
Summary: OpenAPI client-generation wrapper: Litestar spec dump, 3.1->3.0 downgrade, patched openapi-generator templates, Unity package metadata
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
License-File: NOTICE
|
|
7
7
|
Requires-Python: >=3.13
|
|
8
8
|
Requires-Dist: bashrun>=0.1.0
|
|
9
|
+
Requires-Dist: packaging>=24.1
|
|
9
10
|
Requires-Dist: pydantic>=2.11.7
|
|
11
|
+
Requires-Dist: strictyaml>=1.7.3
|
|
10
12
|
Requires-Dist: typer>=0.17.4
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
openapi_client_codegen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
openapi_client_codegen/cli.py,sha256=
|
|
2
|
+
openapi_client_codegen/cli.py,sha256=MRBiDCOsjU3dhNvbKAZoHSVto_0V5SSAelaIFo6YxcQ,3189
|
|
3
3
|
openapi_client_codegen/client.py,sha256=hW6RpwJDmnLUo8bN42PQqQGlVanoPFn_46Cdg2L6inE,4773
|
|
4
4
|
openapi_client_codegen/downgrade.py,sha256=7cxQZJRgWR5lNpvyJT-6pg4lVj72LsMRfdYzsNF9DtY,5230
|
|
5
|
-
openapi_client_codegen/orchestrator.py,sha256=
|
|
5
|
+
openapi_client_codegen/orchestrator.py,sha256=kX5C4-DbMGGVNc9k6bF7CaKCN3Rx2uJG-M3Qu6uIAAc,1842
|
|
6
6
|
openapi_client_codegen/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
openapi_client_codegen/resources.py,sha256=Vavy0_zqot1eDrFpDJ_BT4Sbx47vh7zuclPjQtW3QMw,266
|
|
8
8
|
openapi_client_codegen/templates.py,sha256=ll3NQfdnpVgDOz4WJrEga5lHljEOOItSD1aeVP5Hp80,1198
|
|
@@ -17,9 +17,9 @@ openapi_client_codegen/_data/templates-patches/csharp/0004-csharp-support-hybrid
|
|
|
17
17
|
openapi_client_codegen/_data/templates-patches/csharp/0006-csharp-streaming-download-response.patch,sha256=ma-QkJA94jmN3scbJifaVPMcg_NNZ8klVO2HUrLMz_Y,2417
|
|
18
18
|
openapi_client_codegen/_data/templates-patches/csharp/0007-csharp-model-default-initializers.patch,sha256=_fIimm7K0Gh1IYE3_fYyhUom_g-Bm4HlN9jLgsP27IE,862
|
|
19
19
|
openapi_client_codegen/_data/templates-patches/csharp/0008-csharp-redirect-documentation-file.patch,sha256=HQXDgm_CzFYK4oxOoqBkYAz4wrKKPlYpLgTNHI_0IYc,1363
|
|
20
|
-
openapi_client_codegen-0.1.
|
|
21
|
-
openapi_client_codegen-0.1.
|
|
22
|
-
openapi_client_codegen-0.1.
|
|
23
|
-
openapi_client_codegen-0.1.
|
|
24
|
-
openapi_client_codegen-0.1.
|
|
25
|
-
openapi_client_codegen-0.1.
|
|
20
|
+
openapi_client_codegen-0.1.12.dist-info/METADATA,sha256=Jbe1g2jfYivNHd7nznL5SsSTpne11MjpLkLfytExM5A,433
|
|
21
|
+
openapi_client_codegen-0.1.12.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
22
|
+
openapi_client_codegen-0.1.12.dist-info/entry_points.txt,sha256=mw8FL3PBefHSxRjhBJunBk9G1efUKgxNXwAlghbc31E,74
|
|
23
|
+
openapi_client_codegen-0.1.12.dist-info/licenses/LICENSE,sha256=RFhQPdSOiMTguUX7JSoIuTxA7HVzCbj_p8WU36HjUQQ,10947
|
|
24
|
+
openapi_client_codegen-0.1.12.dist-info/licenses/NOTICE,sha256=jvglZza3GCdN7v4_TLuXUqX9C_uABlwAKUkcIeKwk_8,26
|
|
25
|
+
openapi_client_codegen-0.1.12.dist-info/RECORD,,
|
|
File without changes
|
{openapi_client_codegen-0.1.10.dist-info → openapi_client_codegen-0.1.12.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{openapi_client_codegen-0.1.10.dist-info → openapi_client_codegen-0.1.12.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{openapi_client_codegen-0.1.10.dist-info → openapi_client_codegen-0.1.12.dist-info}/licenses/NOTICE
RENAMED
|
File without changes
|