You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prompted by the super-quick fix of #507 (thanks!) I'm doing some more testing of jsonargparse with nested optional dataclasses, and found out:
Fields of optional dataclasses are not displayed in the generated help
To reproduce
Following script
import jsonargparse
from typing import Optional
from dataclasses import dataclass
@dataclass
class B:
c: int = 3
@dataclass
class A:
b: B
ob: Optional[B]
def fun(a: A):
print(a)
jsonargparse.CLI(fun)
when ran: python python-jsonargparse-optional-dataclass.py -h
displays:
...
-h, --help Show this help message and exit.
--config CONFIG Path to a configuration file.
--print_config[=flags]
Print the configuration after applying all other arguments and exit. The optional flags customizes the output and
are one or more keywords separated by comma. The supported flags are: comments, skip_default, skip_null.
A(b: __main__.B, ob: Optional[__main__.B]):
--a CONFIG Path to a configuration file.
--a.ob OB (type: Optional[B], default: null)
B(c: int = 3):
--a.b CONFIG Path to a configuration file.
--a.b.c C (type: int, default: 3)
Note, --a.ob.c is missing, but I can configure using this option:
Thank you for reporting! This is actually a feature request duplicate of #368. The proposal is to do as described in #368 (comment), though this hasn't yet been implemented. I will close this issue in favor of the previous one.
🐛 Bug report
Prompted by the super-quick fix of #507 (thanks!) I'm doing some more testing of jsonargparse with nested optional dataclasses, and found out:
Fields of optional dataclasses are not displayed in the generated help
To reproduce
Following script
when ran:
python python-jsonargparse-optional-dataclass.py -h
displays:
Note,
--a.ob.c
is missing, but I can configure using this option:Expected behavior
The
--a.ob.c
option should also be displayed in the help.Environment
pip install -e ".[dev,all]"
from checked-out repo.The text was updated successfully, but these errors were encountered: