-
-
Notifications
You must be signed in to change notification settings - Fork 98
Closed
Labels
Description
Hi,
The fields of a sub-model annotated with CliSuppress
are still visible in the CLI help message. I would expect them to be hidden as well.
Example code:
import pydantic
import pydantic_settings
class SubModel(pydantic.BaseModel):
hidden_a: int
hidden_b: int
class Settings(pydantic_settings.BaseSettings, cli_parse_args=True):
visible_str: str
hidden_str: pydantic_settings.CliSuppress[str]
hidden_obj: pydantic_settings.CliSuppress[SubModel]
settings = Settings()
Result:
usage: test.py [-h] [--visible_str str] [--hidden_obj JSON] [--hidden_obj.hidden_a int] [--hidden_obj.hidden_b int]
options:
-h, --help show this help message and exit
--visible_str str (required)
hidden_obj options:
--hidden_obj JSON set hidden_obj from JSON string
--hidden_obj.hidden_a int
(required)
--hidden_obj.hidden_b int
(required)
Reproduced with pydantic-settings 2.8.1
Thanks!