-
Notifications
You must be signed in to change notification settings - Fork 134
Open
Labels
Description
Currently, a field like this:
- input:
range: SourceInput
slot_uri: schema:object
description: >-
The inputs to this source.
If the source represents external import of a sequence, it's empty.
required: false
multivalued: true
inlined_as_list: trueWill get transformed into a pydantic model like below, where the default value is None.
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
default=None,
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
)Instead, you may want the default value to be an empty array (e.g. if this represents a relationship field), so instead of default=None, in pydantic you would want something like default_factory=list.
Is there a supported way for this already? (I don't think it's possible using ifabsent).
This seems like a fairly common use-case. If there is a ready solution, I am happy to contribute the information to the documentation.