You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
only renders the text_input (for password) visually, and consequently, when pressing "Submit" in the form, will rightly refuse to create a corresponding instance, as there are missing required arguments (settings).
When debugging, the problem happens in ui_rendere.py:117, when getting the _schema_references: I get a warning:
This {} is also the reason for the missing input behaviour, as the references cannot be resolved.
See note below for a partial fix!
Expected behaviour:
Nested models working
Steps to reproduce the issue:
See snippet above.
Technical details:
Host Machine OS (Windows/Linux/Mac): Windows
Browser (Chrome/Firefox/Safari): Firefox
Streamlit: 1.24.1
Pydantic: 2.0.3
Possible Fix:
It seems that the internal schema of the model classes have changed with 2.0
In ui_renderer.py, line 118 and 1171 in the .get changing "definitions" to "$defs" seems to work in the first order:
Next to password also the settings defined in DisplaySettings and InputSettings are rendered. BUT there is still a problem with the list fields nested in OtherSettings which needs further investigation.
I'm sorry that the PR #35 was not enough to make the lib fully pydantic 2.0 compliant.
As I said, s/"definitions"/"$defs"/ solves some of the problems, but still not all.
The text was updated successfully, but these errors were encountered:
Ok, so the issue wrt. nested models not working with pydatnic 2 is resolved by the "suggested fixes".
However, the "list" not working seems to be an orthogonal problem, not related to pydantic 2 (but maybe changes in streamlit, compared to earlier versions):
List-Editing is solved in streamlit-pydantic among others by adding a button: self._render_list_add_button(key, add_col, data_list) (ui_renderer.py:1000), but that tries to add a streamlit.button(...) to the interface. However, adding a regular button within a form is disallowed by (at least current) streamlit button.py:407-411 raising an exception (which is then silently caught and ignored).
Describe the bug:
With pydantic 2.0 (using the patched version from #35), I get an error on nested models.
only renders the
text_input
(forpassword
) visually, and consequently, when pressing "Submit" in the form, will rightly refuse to create a corresponding instance, as there are missing required arguments (settings
).When debugging, the problem happens in
ui_rendere.py:117
, when getting the_schema_references
: I get a warning:and
self._schema_references
is set to {}.This
{}
is also the reason for the missing input behaviour, as the references cannot be resolved.See note below for a partial fix!
Expected behaviour:
Nested models working
Steps to reproduce the issue:
See snippet above.
Technical details:
Possible Fix:
It seems that the internal schema of the model classes have changed with 2.0
In
ui_renderer.py
, line 118 and 1171 in the.get
changing"definitions"
to"$defs"
seems to work in the first order:Next to
password
also the settings defined inDisplaySettings
andInputSettings
are rendered.BUT there is still a problem with the
list
fields nested inOtherSettings
which needs further investigation.I'm sorry that the PR #35 was not enough to make the lib fully pydantic 2.0 compliant.
As I said,
s/"definitions"/"$defs"/
solves some of the problems, but still not all.The text was updated successfully, but these errors were encountered: