|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | 5 | import json |
6 | | -import sys |
7 | | -from pathlib import Path |
8 | | -from typing import Optional |
9 | | - |
10 | 6 | import typer |
| 7 | +from pathlib import Path |
11 | 8 | from rich.console import Console |
12 | 9 | from rich.table import Table |
13 | | -from rich.panel import Panel |
14 | | -from rich.text import Text |
15 | 10 |
|
16 | 11 | try: |
17 | 12 | from revenueholdings_license import require_license |
18 | 13 | except ImportError: |
19 | 14 | require_license = None |
20 | 15 |
|
21 | | -from .diff import DiffResult, Severity, diff_specs |
22 | | -from .gate import GateResult, check_gate |
| 16 | +from .diff import DiffResult, diff_specs |
| 17 | +from .gate import check_gate |
23 | 18 | from .loader import SpecLoadError, load_spec, validate_openapi_version |
24 | 19 | from .migration import generate_migration_guide, generate_migration_guide_json |
25 | 20 |
|
@@ -86,7 +81,7 @@ def _print_result(result: DiffResult) -> None: |
86 | 81 | def diff( |
87 | 82 | old: str = typer.Argument(..., help="Path to old (baseline) OpenAPI spec"), |
88 | 83 | new: str = typer.Argument(..., help="Path to new (proposed) OpenAPI spec"), |
89 | | - output: Optional[str] = typer.Option(None, "--output", "-o", help="Output file path"), |
| 84 | + output: str | None = typer.Option(None, "--output", "-o", help="Output file path"), |
90 | 85 | format: str = typer.Option("rich", "--format", "-f", help="Output format: rich, json, markdown"), |
91 | 86 | ) -> None: |
92 | 87 | """Compare two OpenAPI specs and show all detected changes.""" |
@@ -127,7 +122,7 @@ def check( |
127 | 122 | fail_on_dangerous: bool = typer.Option(False, "--fail-on-dangerous/--allow-dangerous", help="Fail on dangerous changes"), |
128 | 123 | max_breaking: int = typer.Option(0, "--max-breaking", help="Max allowed breaking changes (default 0)"), |
129 | 124 | max_dangerous: int = typer.Option(-1, "--max-dangerous", help="Max allowed dangerous changes (-1=unlimited)"), |
130 | | - output: Optional[str] = typer.Option(None, "--output", "-o", help="Output file path"), |
| 125 | + output: str | None = typer.Option(None, "--output", "-o", help="Output file path"), |
131 | 126 | ) -> None: |
132 | 127 | """Gate CI pipeline on breaking changes. Returns exit code 1 if gate fails.""" |
133 | 128 | if require_license: |
@@ -167,7 +162,7 @@ def check( |
167 | 162 | def migrate( |
168 | 163 | old: str = typer.Argument(..., help="Path to old (baseline) OpenAPI spec"), |
169 | 164 | new: str = typer.Argument(..., help="Path to new (proposed) OpenAPI spec"), |
170 | | - output: Optional[str] = typer.Option(None, "--output", "-o", help="Output file path"), |
| 165 | + output: str | None = typer.Option(None, "--output", "-o", help="Output file path"), |
171 | 166 | format: str = typer.Option("markdown", "--format", "-f", help="Output format: markdown, json"), |
172 | 167 | ) -> None: |
173 | 168 | """Generate a migration guide between two OpenAPI spec versions.""" |
|
0 commit comments