Skip to content

Single value literal doesn't work in select form #234

@ManiMozaffar

Description

@ManiMozaffar

To reproduce this issue, just change the ToolEnum to Literal of ToolEnum.hammer in demo source code.

Screenshot 2024-03-04 at 11 00 32

Error trace

  File "/Users/manimozaffar/Desktop/fastui/src/python-fastui/fastui/json_schema.py", line 157, in json_schema_obj_to_fields
    yield from json_schema_any_to_fields(value, loc + [key], title, key in required, defs)
  File "/Users/manimozaffar/Desktop/fastui/src/python-fastui/fastui/json_schema.py", line 166, in json_schema_any_to_fields
    if schema_is_field(schema):
       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/manimozaffar/Desktop/fastui/src/python-fastui/fastui/json_schema.py", line 379, in schema_is_field
    return schema['type'] in {'string', 'number', 'integer', 'boolean'}
           ~~~~~~^^^^^^^^
KeyError: 'type'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions