import json import sys def main(): if len(sys.argv) > 1: openapi_path = sys.argv[1] else: openapi_path = '/tmp/openapi.json' try: with open(openapi_path, 'r') as f: spec = json.load(f) except Exception as e: print(f"Failed to load {openapi_path}: {e}") sys.exit(1) paths = spec.get('paths', {}) expected_prefixes = ['/api/reimbursements', '/api/workflow/tasks', '/api/invoice-pool'] missing_prefixes = [] for prefix in expected_prefixes: matched = any(p.startswith(prefix) for p in paths.keys()) if not matched: missing_prefixes.append(prefix) if missing_prefixes: print(f"ERROR: Missing expected root paths in OpenAPI schema: {missing_prefixes}") sys.exit(1) print(f"SUCCESS: Drift check passed. Found {len(paths)} paths.") if __name__ == '__main__': main()