openapi-client-codegen 0.1.13__py3-none-any.whl → 0.1.14__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.
@@ -3,6 +3,7 @@ from pathlib import Path
3
3
  from tempfile import TemporaryDirectory
4
4
  from typing import Annotated
5
5
 
6
+ from bashrun.bash import bash, bash_output
6
7
  from typer import Option, Typer
7
8
 
8
9
  from .client import generate_client
@@ -23,11 +24,16 @@ def generate_projects_command(
23
24
  no_cache: Annotated[
24
25
  bool, Option("--no-cache", help="Regenerate even when the committed spec is unchanged")
25
26
  ] = False,
27
+ check: Annotated[
28
+ bool,
29
+ Option("--check", help="Regenerate, then fail if any spec or generated client differs from the committed tree"),
30
+ ] = False,
26
31
  root: Annotated[Path, Option(help="Repository root the project paths resolve against")] = Path(),
27
32
  ) -> None:
28
33
  settings = load_config(config)
29
34
  root = root.resolve()
30
35
  dump_spec = SpecProducer(settings.spec_command, env=settings.spec_env)
36
+ regenerate = no_cache or check
31
37
 
32
38
  with TemporaryDirectory() as templates_directory_string:
33
39
  templates_directory = Path(templates_directory_string)
@@ -49,7 +55,7 @@ def generate_projects_command(
49
55
  if spec_path.exists():
50
56
  old_spec = spec_path.read_text(encoding="utf-8")
51
57
 
52
- if openapi_spec == old_spec and not no_cache:
58
+ if openapi_spec == old_spec and not regenerate:
53
59
  print("OpenAPI spec unchanged, skipping client generation")
54
60
  continue
55
61
 
@@ -78,3 +84,11 @@ def generate_projects_command(
78
84
  license_spdx=settings.license_spdx,
79
85
  repository_url=settings.repository_url,
80
86
  )
87
+
88
+ if check:
89
+ pathspec = " ".join(f"{name}/openapi.json" for name in settings.projects) + f" {settings.generated_root}"
90
+ if bash_output(f"git status --porcelain -- {pathspec}", cwd=root).strip():
91
+ bash(f"git diff -- {pathspec}", cwd=root)
92
+ raise SystemExit(
93
+ "Generated OpenAPI specs/clients are stale; re-run this command without --check and commit the result."
94
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: openapi-client-codegen
3
- Version: 0.1.13
3
+ Version: 0.1.14
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
@@ -1,5 +1,5 @@
1
1
  openapi_client_codegen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- openapi_client_codegen/cli.py,sha256=MRBiDCOsjU3dhNvbKAZoHSVto_0V5SSAelaIFo6YxcQ,3189
2
+ openapi_client_codegen/cli.py,sha256=VxI4wbkaeWwES56Hx3EMygrMRE08OwbUY3PdMszOwx4,3871
3
3
  openapi_client_codegen/client.py,sha256=hW6RpwJDmnLUo8bN42PQqQGlVanoPFn_46Cdg2L6inE,4773
4
4
  openapi_client_codegen/downgrade.py,sha256=7cxQZJRgWR5lNpvyJT-6pg4lVj72LsMRfdYzsNF9DtY,5230
5
5
  openapi_client_codegen/orchestrator.py,sha256=kX5C4-DbMGGVNc9k6bF7CaKCN3Rx2uJG-M3Qu6uIAAc,1842
@@ -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.13.dist-info/METADATA,sha256=LXopObxE11_nuvedh-e3k7JQ8gTs7ZgGHHwh52EJDqA,433
21
- openapi_client_codegen-0.1.13.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
22
- openapi_client_codegen-0.1.13.dist-info/entry_points.txt,sha256=mw8FL3PBefHSxRjhBJunBk9G1efUKgxNXwAlghbc31E,74
23
- openapi_client_codegen-0.1.13.dist-info/licenses/LICENSE,sha256=RFhQPdSOiMTguUX7JSoIuTxA7HVzCbj_p8WU36HjUQQ,10947
24
- openapi_client_codegen-0.1.13.dist-info/licenses/NOTICE,sha256=jvglZza3GCdN7v4_TLuXUqX9C_uABlwAKUkcIeKwk_8,26
25
- openapi_client_codegen-0.1.13.dist-info/RECORD,,
20
+ openapi_client_codegen-0.1.14.dist-info/METADATA,sha256=dIl50eehlZAo6x4nqG_XqdaiM5mQmykUtX3Gfs4tm3o,433
21
+ openapi_client_codegen-0.1.14.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
22
+ openapi_client_codegen-0.1.14.dist-info/entry_points.txt,sha256=mw8FL3PBefHSxRjhBJunBk9G1efUKgxNXwAlghbc31E,74
23
+ openapi_client_codegen-0.1.14.dist-info/licenses/LICENSE,sha256=RFhQPdSOiMTguUX7JSoIuTxA7HVzCbj_p8WU36HjUQQ,10947
24
+ openapi_client_codegen-0.1.14.dist-info/licenses/NOTICE,sha256=jvglZza3GCdN7v4_TLuXUqX9C_uABlwAKUkcIeKwk_8,26
25
+ openapi_client_codegen-0.1.14.dist-info/RECORD,,