Skip to content

Select description gets attached to multiple field #178

Closed
@tim-x-y-z

Description

@tim-x-y-z

In the demo here if we add a description to the first select as:

class SelectForm(BaseModel):
    select_single: ToolEnum = Field(title='Select Single', description="First selector")
    select_multiple: list[ToolEnum] = Field(title='Select Multiple')
    search_select_single: str = Field(json_schema_extra={'search_url': '/api/forms/search'})
    search_select_multiple: list[str] = Field(json_schema_extra={'search_url': '/api/forms/search'})

it produces the following, where we can see the description leaking to the next select:
image

However, I noticed that if I use a different Enum for the second selector this does not happen; e.g:

class ToolEnum2(str, enum.Enum):
    hammer = 'hammer'
    screwdriver = 'screwdriver'
    saw = 'saw'
    claw_hammer = 'claw_hammer'

class SelectForm(BaseModel):
    select_single: ToolEnum = Field(title='Select Single', description="First selector")
    select_multiple: list[ToolEnum2] = Field(title='Select Multiple')
    search_select_single: str = Field(json_schema_extra={'search_url': '/api/forms/search'})
    search_select_multiple: list[str] = Field(json_schema_extra={'search_url': '/api/forms/search'})

Screenshot 2024-02-09 at 17 59 48

Note: adding a description to the second select in the initial case doesn't work either, the first description still keeps it spot:

class SelectForm(BaseModel):
    select_single: ToolEnum = Field(title='Select Single', description="First selector")
    select_multiple: list[ToolEnum] = Field(title='Select Multiple', description="Second selector")
    search_select_single: str = Field(json_schema_extra={'search_url': '/api/forms/search'})
    search_select_multiple: list[str] = Field(json_schema_extra={'search_url': '/api/forms/search'})

image

my 2 cents; I believe the description gets attached to the components by it's name and the component name is derived by the Enum name - though i am unsure how to solve it for now

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions