biolink / biolinkml

DEPRECATED: replaced by linkml
https://github.com/linkml/linkml
Creative Commons Zero v1.0 Universal
23 stars 12 forks source link

Boolean values don't include underlying python type #338

Closed hsolbrig closed 3 years ago

hsolbrig commented 3 years ago

The signature for an optional boolean should be Optional[Union[bool, Bool]] rather than Optional[Bool]. Without the other part of the signature, you get:

image

Note: it appears that Optional[bool, Bool] can (now?) be used as shorthand for the above. If this feature is in python 3.7 on, we should also consider simplifying the generator to remove some of the Union noise.

hsolbrig commented 3 years ago

Note - while PyCharm is ok with the Optional[bool, Bool] syntax, this raises a runtime error in dataclass. The Union has to be there