From 20615eca254e2387341ffddb39e96a8e8af3621f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Wed, 12 Nov 2025 10:52:55 +0100 Subject: [PATCH] chore: fail if any schema is invalid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not continue the generation, print which schema failed. Signed-off-by: Sébastien Han --- scripts/fastapi_generator.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/fastapi_generator.py b/scripts/fastapi_generator.py index bbf55f8ed..054db71cf 100755 --- a/scripts/fastapi_generator.py +++ b/scripts/fastapi_generator.py @@ -1472,8 +1472,17 @@ def generate_openapi_spec(output_dir: str) -> dict[str, Any]: deprecated_valid = validate_openapi_schema(deprecated_schema, "Deprecated schema") combined_valid = validate_openapi_schema(combined_schema, "Combined (stainless) schema") - if not all([stable_valid, experimental_valid, deprecated_valid, combined_valid]): - print("⚠️ Some schemas failed validation, but continuing with generation...") + failed_schemas = [] + if not stable_valid: + failed_schemas.append("Stable schema") + if not experimental_valid: + failed_schemas.append("Experimental schema") + if not deprecated_valid: + failed_schemas.append("Deprecated schema") + if not combined_valid: + failed_schemas.append("Combined (stainless) schema") + if failed_schemas: + raise ValueError(f"Invalid schemas: {', '.join(failed_schemas)}") # Ensure output directory exists output_path = Path(output_dir)