The null vs undefined problem Does anybody know w...
# proj-sdk
s
The null vs undefined problem Does anybody know why we use
exclude_none
when dumping some of our pydantic models? (e.g.: https://github.com/OpenHands/software-agent-sdk/blame/7fed9444c88f43daeb9ad395fcc14161602849b3/openhands-sdk/openhands/sdk/conversation/state.py#L141C22-L141C22) Was it just to save space or was there another reason? This causes issues when None is an accepted value which is not the default. For example: https://github.com/OpenHands/software-agent-sdk/blob/7fed9444c88f43daeb9ad395fcc14[…]161602849b3/openhands-sdk/openhands/sdk/context/skills/skill.py In skill, the trigger can be
None
(Meaning the Skill is always active), but when serialized this value will be excluded if it is
None
, so that the default will be used - but there is no default! I could: • Update all fields that permit None and do not have a default value to have a default value of None 🫠 • Remove the
exclude_none
šŸ™‚ I favor removing the
exclude_none
, as setting a default of
None
may not be desired in all cases.
c
I'm not sure why we exclude None. But I'm pretty sure "no trigger" should be default. No reason not to, and we used to have that behavior as default, it just got lost in porting / refactoring I think.
s
ok - that is a smaller and probably less controversial fix
We can defer the discussion about whether Null should be explicit or implicit until later
c
Thank you!
s
@chilly-france-44439 - saw your comment on https://github.com/OpenHands/software-agent-sdk/pull/1212 - I had moved the docstring into the field description. (Since it relates to the field) Do you prefer it in the class description?
c
I think it is ok to keep both?
s
If you prefer - though it is a bit verbose and less DRY
c
yeah, i think it will be nice to show user there are three type of Skills in the class docstring, rather than the docstring of a field (which might not be easily spotted)
šŸ‘ 1