File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed 
pydantic_settings/sources/providers Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -956,7 +956,7 @@ def _add_parser_args(
956956
957957                self ._convert_bool_flag (arg .kwargs , field_info , model_default )
958958
959-                 if  arg .is_parser_submodel :
959+                 if  arg .is_parser_submodel   and   not   getattr ( field_info . annotation ,  '__pydantic_root_model__' ,  False ) :
960960                    self ._add_parser_submodels (
961961                        parser ,
962962                        model ,
@@ -1107,6 +1107,7 @@ def _add_parser_submodels(
11071107            model_group_kwargs ['description' ] =  CLI_SUPPRESS 
11081108        if  not  self .cli_avoid_json :
11091109            added_args .append (arg_names [0 ])
1110+             kwargs ['required' ] =  False 
11101111            kwargs ['nargs' ] =  '?' 
11111112            kwargs ['const' ] =  '{}' 
11121113            kwargs ['help' ] =  (
@@ -1205,8 +1206,12 @@ def _metavar_format_recurse(self, obj: Any) -> str:
12051206            )
12061207        elif  obj  is  type (None ):
12071208            return  self .cli_parse_none_str 
1208-         elif  is_model_class (obj ):
1209-             return  'JSON' 
1209+         elif  is_model_class (obj ) or  is_pydantic_dataclass (obj ):
1210+             return  (
1211+                 self ._metavar_format_recurse (_get_model_fields (obj )['root' ].annotation )
1212+                 if  getattr (obj , '__pydantic_root_model__' , False )
1213+                 else  'JSON' 
1214+             )
12101215        elif  isinstance (obj , type ):
12111216            return  obj .__qualname__ 
12121217        else :
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments