File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
pydantic_settings/sources/providers Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -923,11 +923,13 @@ def _add_parser_submodels(
923923
924924 preferred_alias = alias_names [0 ]
925925 is_model_suppressed = self ._is_field_suppressed (field_info ) or is_model_suppressed
926+ if is_model_suppressed :
927+ model_group_kwargs ['description' ] = CLI_SUPPRESS
926928 if not self .cli_avoid_json :
927929 added_args .append (arg_names [0 ])
928930 kwargs ['nargs' ] = '?'
929931 kwargs ['const' ] = '{}'
930- kwargs ['help' ] = kwargs [ 'help' ] = (
932+ kwargs ['help' ] = (
931933 CLI_SUPPRESS if is_model_suppressed else f'set { arg_names [0 ]} from JSON string (default: {{}})'
932934 )
933935 model_group = self ._add_group (parser , ** model_group_kwargs )
Original file line number Diff line number Diff line change @@ -2159,17 +2159,17 @@ class DeepHiddenSubModel(BaseModel):
21592159 class HiddenSubModel (BaseModel ):
21602160 hidden_a : int
21612161 hidden_b : int
2162- deep_hidden_obj : DeepHiddenSubModel
2162+ deep_hidden_obj : DeepHiddenSubModel = Field ( description = 'deep_hidden_obj description' )
21632163
21642164 class SubModel (BaseModel ):
21652165 visible_a : int
21662166 visible_b : int
2167- deep_hidden_obj : CliSuppress [DeepHiddenSubModel ]
2167+ deep_hidden_obj : CliSuppress [DeepHiddenSubModel ] = Field ( description = 'deep_hidden_obj description' )
21682168
21692169 class Settings (BaseSettings , cli_parse_args = True ):
21702170 field_a : CliSuppress [int ] = 0
2171- field_b : str = Field (default = 1 , description = CLI_SUPPRESS )
2172- hidden_obj : CliSuppress [HiddenSubModel ]
2171+ field_b : str = Field (default = 'hi' , description = CLI_SUPPRESS )
2172+ hidden_obj : CliSuppress [HiddenSubModel ] = Field ( description = 'hidden_obj description' )
21732173 visible_obj : SubModel
21742174
21752175 with monkeypatch .context () as m :
You can’t perform that action at this time.
0 commit comments