Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/python-fastui/fastui/json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,20 @@ def json_schema_field_to_field(
initial=schema.get('default'),
description=schema.get('description'),
mode=schema.get('mode', 'checkbox'),
class_name=schema.get('className'),
)
elif field := special_string_field(schema, name, title, required, False):
return field
else:
return FormFieldInput(
name=name,
title=title,
placeholder=schema.get('placeholder'),
html_type=input_html_type(schema),
required=required,
initial=schema.get('default'),
description=schema.get('description'),
class_name=schema.get('className'),
)


Expand Down Expand Up @@ -235,6 +238,7 @@ def special_string_field(
multiple=multiple,
accept=schema.get('accept'),
description=schema.get('description'),
class_name=schema.get('className'),
)
elif enum := schema.get('enum'):
enum_labels = schema.get('enum_labels', {})
Expand All @@ -247,6 +251,7 @@ def special_string_field(
options=[SelectOption(value=v, label=enum_labels.get(v) or as_title(v)) for v in enum],
initial=schema.get('default'),
description=schema.get('description'),
class_name=schema.get('className'),
)
elif search_url := schema.get('search_url'):
return FormFieldSelectSearch(
Expand All @@ -258,6 +263,7 @@ def special_string_field(
multiple=multiple,
initial=schema.get('initial'),
description=schema.get('description'),
class_name=schema.get('className'),
)


Expand Down