openapi-spec-tools 0.14.0__tar.gz → 0.15.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.
Files changed (45) hide show
  1. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/PKG-INFO +2 -2
  2. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/cli/history.py +49 -0
  3. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/pyproject.toml +2 -2
  4. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/LICENSE +0 -0
  5. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/README.md +0 -0
  6. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/__init__.py +0 -0
  7. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/api_gen/_environment.py +0 -0
  8. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/api_gen/api_generator.py +0 -0
  9. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/api_gen/files.py +0 -0
  10. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/api_gen/flat_generator.py +0 -0
  11. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/api_gen/opaque_generator.py +0 -0
  12. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/api_gen/property_generator.py +0 -0
  13. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/base_gen/_logging.py +0 -0
  14. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/base_gen/_requests.py +0 -0
  15. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/base_gen/base_generator.py +0 -0
  16. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/base_gen/constants.py +0 -0
  17. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/base_gen/files.py +0 -0
  18. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/base_gen/utils.py +0 -0
  19. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/cli/api_gen.py +0 -0
  20. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/cli/arguments.py +0 -0
  21. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/cli/cli_gen.py +0 -0
  22. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/cli/layout.py +0 -0
  23. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/cli/oas.py +0 -0
  24. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/cli/utils.py +0 -0
  25. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/cli_gen/_arguments.py +0 -0
  26. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/cli_gen/_display.py +0 -0
  27. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/cli_gen/_exceptions.py +0 -0
  28. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/cli_gen/_tree.py +0 -0
  29. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/cli_gen/cli_generator.py +0 -0
  30. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/cli_gen/constants.py +0 -0
  31. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/cli_gen/files.py +0 -0
  32. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/layout/layout_generator.py +0 -0
  33. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/layout/merge.py +0 -0
  34. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/layout/types.py +0 -0
  35. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/layout/utils.py +0 -0
  36. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/types.py +0 -0
  37. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/openapi_spec_tools/utils.py +0 -0
  38. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/tests/cli_gen/__init__.py +0 -0
  39. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/tests/cli_gen/helpers.py +0 -0
  40. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/tests/cli_gen/test_cli_generator.py +0 -0
  41. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/tests/cli_gen/test_display.py +0 -0
  42. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/tests/cli_gen/test_exceptions.py +0 -0
  43. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/tests/cli_gen/test_files.py +0 -0
  44. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/tests/cli_gen/test_main.py +0 -0
  45. {openapi_spec_tools-0.14.0 → openapi_spec_tools-0.15.0}/tests/cli_gen/test_tree.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openapi-spec-tools
3
- Version: 0.14.0
3
+ Version: 0.15.0
4
4
  Summary: OpenAPI specification tools for analyzing, updating, and generating a CLI.
5
5
  License-File: LICENSE
6
6
  Author: Rick Porter
@@ -24,7 +24,7 @@ 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-Dist: gitpython (>=3.1.47,<4.0.0)
27
+ Requires-Dist: gitpython (>=3.1.50,<4.0.0)
28
28
  Requires-Dist: pydantic (>=2.13.3,<3.0.0)
29
29
  Requires-Dist: pyyaml (>=6.0.3,<7.0.0)
30
30
  Requires-Dist: requests (>=2.33.1,<3.0.0)
@@ -202,5 +202,54 @@ def commit_changes(
202
202
  return
203
203
 
204
204
 
205
+ @app.command("show", short_help="Show single OAS change in git history.")
206
+ def commit_show(
207
+ oas_file: OpenApiFilenameArgument,
208
+ commit: Annotated[
209
+ str | None,
210
+ typer.Argument(help="Commit hash"),
211
+ ],
212
+ out_fmt: OutputFormatOption = OutputFormat.TABLE,
213
+ out_style: OutputStyleOption = OutputStyle.ALL,
214
+ ):
215
+ """Show OAS changes over the history of the provided search. The ."""
216
+ _assert_exists(oas_file)
217
+ _commit_id = commit.lower()
218
+ # NOTE: do not filter out commits by other authors, or before start, or will get odd comparisons
219
+ commits = _find_commits(oas_file=oas_file)
220
+ columns = ["date", "commit", "changes"]
221
+ data = []
222
+ prev_comm = commits[0]
223
+ prev_data = _read_data(prev_comm, oas_file)
224
+ for curr_comm in commits[1:]:
225
+ if _commit_id in prev_comm.hexsha:
226
+ # because we're walking backward chronologicallly, the prev/curr are different order
227
+ curr_data = _read_data(curr_comm, oas_file)
228
+ prev_data = _read_data(prev_comm, oas_file)
229
+ changes = find_diffs(curr_data, prev_data)
230
+ if out_fmt == OutputFormat.TABLE:
231
+ # YAML format is the best looking format for the diffs in a table, so force it
232
+ changes = yaml.dump(changes).strip()
233
+ data.append(
234
+ {
235
+ "date": prev_comm.authored_datetime.date().isoformat(),
236
+ "commit": prev_comm.hexsha[:7],
237
+ "changes": changes,
238
+ }
239
+ )
240
+ break
241
+
242
+ prev_comm = curr_comm
243
+
244
+ console = console_factory()
245
+ if not data:
246
+ console.print("No matching commit found.")
247
+ return
248
+
249
+ config = TableConfig(value_max_len=1000)
250
+ display(data, fmt=out_fmt, style=out_style, columns=columns, config=config, console=console)
251
+ return
252
+
253
+
205
254
  if __name__ == "__main__":
206
255
  app()
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "openapi-spec-tools"
3
- version = "0.14.0"
3
+ version = "0.15.0"
4
4
  description = "OpenAPI specification tools for analyzing, updating, and generating a CLI."
5
5
  authors = ["Rick Porter <rickwporter@gmail.com>"]
6
6
  readme = "README.md"
@@ -41,7 +41,7 @@ rich = "^14.3.3"
41
41
  requests = "^2.33.1"
42
42
  pydantic = "^2.13.3"
43
43
  rich-objects = "^0.2.3"
44
- gitpython = "^3.1.47"
44
+ gitpython = "^3.1.50"
45
45
 
46
46
  [tool.poetry.scripts]
47
47
  oas = "openapi_spec_tools.cli.oas:app"