Archived
feat: enhance extract_field_schema to support inline options for type inference
This commit is contained in:
1 parent
82559292b1
commit
632ba7b32a
1 file changed
+4
-3
+4
-3
@@ -203,8 +203,9 @@ 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)
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user