File tree 2 files changed +7
-5
lines changed
pydantic_settings/sources/providers 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(
923
923
924
924
preferred_alias = alias_names [0 ]
925
925
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
926
928
if not self .cli_avoid_json :
927
929
added_args .append (arg_names [0 ])
928
930
kwargs ['nargs' ] = '?'
929
931
kwargs ['const' ] = '{}'
930
- kwargs ['help' ] = kwargs [ 'help' ] = (
932
+ kwargs ['help' ] = (
931
933
CLI_SUPPRESS if is_model_suppressed else f'set { arg_names [0 ]} from JSON string (default: {{}})'
932
934
)
933
935
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):
2159
2159
class HiddenSubModel (BaseModel ):
2160
2160
hidden_a : int
2161
2161
hidden_b : int
2162
- deep_hidden_obj : DeepHiddenSubModel
2162
+ deep_hidden_obj : DeepHiddenSubModel = Field ( description = 'deep_hidden_obj description' )
2163
2163
2164
2164
class SubModel (BaseModel ):
2165
2165
visible_a : int
2166
2166
visible_b : int
2167
- deep_hidden_obj : CliSuppress [DeepHiddenSubModel ]
2167
+ deep_hidden_obj : CliSuppress [DeepHiddenSubModel ] = Field ( description = 'deep_hidden_obj description' )
2168
2168
2169
2169
class Settings (BaseSettings , cli_parse_args = True ):
2170
2170
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' )
2173
2173
visible_obj : SubModel
2174
2174
2175
2175
with monkeypatch .context () as m :
You can’t perform that action at this time.
0 commit comments