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
similar cause of the problem: if v3 does not have default in SubModel, it raise an error:
pydantic_core._pydantic_core.ValidationError: 1 validation error for Settings
sub_model.v3
Field required [type=missing, input_value={'v1': "'cli'"}, input_type=dict]
I think we need to enable partial update with nested sub model, otherwise, the BaseSettings does not really support nested model field as cli arg or environment variable. If we decide not to support partial update, I guess it is better to drop the env_nested and --field.subfield idea completely. Because this behaviour, especially the silent fallback to SubModel's default will completely surprise the user.
The text was updated successfully, but these errors were encountered:
I think the behavior is the same as the env settings source. if you run the example code by SUB_MODEL__V1=cli python example.py you will get the same result.
There was a long discussion about this topic at #347. it is a pydantic-settings V2 limitation.
Hi @braindevices, I've added a flag nested_model_default_partial_update that enables partial updates for default model objects. Could you help verify it resolves your issue and post a simple test for your use case? I believe the case posted in the description is now resolved:
expected value:
similar cause of the problem: if v3 does not have default in SubModel, it raise an error:
I think we need to enable partial update with nested sub model, otherwise, the BaseSettings does not really support nested model field as cli arg or environment variable. If we decide not to support partial update, I guess it is better to drop the env_nested and --field.subfield idea completely. Because this behaviour, especially the silent fallback to SubModel's default will completely surprise the user.
The text was updated successfully, but these errors were encountered: