| 439 | |
| 440 | |
| 441 | def build_parser() -> argparse.ArgumentParser: |
| 442 | parser = argparse.ArgumentParser( |
| 443 | description="Check Apollo OpenAPI specs for incompatible v1 changes." |
| 444 | ) |
| 445 | parser.add_argument("--base", required=True, help="Baseline OpenAPI spec path or URL") |
| 446 | parser.add_argument("--head", required=True, help="Candidate OpenAPI spec path or URL") |
| 447 | parser.add_argument( |
| 448 | "--allow-removed-path", |
| 449 | action="append", |
| 450 | default=[], |
| 451 | help="Allow every operation under this removed path", |
| 452 | ) |
| 453 | parser.add_argument( |
| 454 | "--allow-removed-operation", |
| 455 | action="append", |
| 456 | default=[], |
| 457 | help='Allow one removed operation, formatted like "GET /openapi/v1/apps"', |
| 458 | ) |
| 459 | parser.add_argument( |
| 460 | "--allow-operation-id-change", |
| 461 | action="append", |
| 462 | default=[], |
| 463 | help='Allow one operationId change, formatted like "GET /openapi/v1/apps"', |
| 464 | ) |
| 465 | parser.add_argument( |
| 466 | "--allow-required-addition", |
| 467 | action="append", |
| 468 | default=[], |
| 469 | help='Allow one new required field, formatted like "OpenAppDTO.appId"', |
| 470 | ) |
| 471 | return parser |
| 472 | |
| 473 | |
| 474 | def main(argv: Optional[List[str]] = None) -> int: |