Skip to content

Commit

Permalink
Remove cli key from json_schema_extras to avoid having it displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
mpkocher committed Sep 19, 2024
1 parent 20217fe commit 46c226d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pydantic_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,16 @@ def _add_pydantic_field_to_parser(
"""

default_long_arg = "".join([long_prefix, field_id])
description = field_info.description
# there's mypy type issues here
cli_custom_: Tuple1or2Type = (
(default_long_arg,)
if field_info.json_schema_extra is None # type: ignore
else field_info.json_schema_extra.get("cli", (default_long_arg,)) # type: ignore
)
# Delete cli so the metadata isn't in FieldInfo and won't be displayed
if field_info.json_schema_extra:
_ = field_info.json_schema_extra.pop("cli", None)

cli_short_long: Tuple1or2Type = __process_tuple(cli_custom_, default_long_arg)

is_required = field_info.is_required()
Expand Down

0 comments on commit 46c226d

Please sign in to comment.