From 632ba7b32aa442a33cf147e65e4d8ee00b6303ee Mon Sep 17 00:00:00 2001 From: donnyjang Date: Wed, 14 Jan 2026 23:02:41 -0700 Subject: [PATCH] feat: enhance extract_field_schema to support inline options for type inference --- schema_generator.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/schema_generator.py b/schema_generator.py index 4b29e9f..c8bec52 100644 --- a/schema_generator.py +++ b/schema_generator.py @@ -203,9 +203,10 @@ def extract_field_schema( # Extract component (NEW: explicit UI component key) component = extra.pop("component", None) - # Extract options_source early - needed for type inference + # Extract options_source and inline options early - needed for type inference options_source = extra.get("options_source") - + inline_options = extra.get("options") # inline options array + # Handle List types origin = get_origin(field_type) inner_type = field_type @@ -230,8 +231,8 @@ def extract_field_schema( if not component: component = inferred_source or field_name schema["params"] = get_model_params_schema(field_type) - elif options_source: - # Selection from a list of options + elif options_source or inline_options: + # Selection from a list of options (either dynamic from options_source or inline) schema["type"] = "enum" else: # Primitive type - infer from Python type