mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 18:00:36 +00:00
chore: fail if any schema is invalid
Do not continue the generation, print which schema failed. Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
parent
9d14d6d313
commit
20615eca25
1 changed files with 11 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue