From 78da66016f65b60c70b671a8a4ba6c05982b1828 Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Mon, 28 Apr 2025 10:37:14 -0700 Subject: [PATCH] raise when you find a Literal type we dont support in openapi generator --- llama_stack/strong_typing/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llama_stack/strong_typing/schema.py b/llama_stack/strong_typing/schema.py index e755b4c12..1427c22e6 100644 --- a/llama_stack/strong_typing/schema.py +++ b/llama_stack/strong_typing/schema.py @@ -479,7 +479,7 @@ class JsonSchemaGenerator: return ret elif origin_type is Literal: if len(typing.get_args(typ)) != 1: - print(f"Literal type {typ} has {len(typing.get_args(typ))} arguments") + raise ValueError(f"Literal type {typ} has {len(typing.get_args(typ))} arguments") (literal_value,) = typing.get_args(typ) # unpack value of literal type schema = self.type_to_schema(type(literal_value)) schema["const"] = literal_value