maxfordham / ipyautoui

create ipywidgets user input form pydantic model or jsonschema
https://maxfordham.github.io/ipyautoui/
40 stars 4 forks source link

🐛 widgetcaller issue when using Optional typing for Array #144

Closed ollyhensby closed 1 year ago

ollyhensby commented 1 year ago

Describe The Issue

When a field has an Optional type for an Array, the widgetcaller fails to find the appropriate widget. This may also occur for other custom widgets. Definitely worth checking.

Recreate The Issue

Define simple example schema that will create an Array widget.

from typing import List, Optional
from pydantic import BaseModel

class Example(BaseModel):
    allowed_values: Optional[List[str]]

AutoObject(schema=Example)

Output: Widget not found

image

ollyhensby commented 1 year ago

Already resolved and will be fixed in next release.