For any_of, we have several major use cases:
- To define multiple enumeration options, eg, an expected list and an "unknown" list.
- To define an "example" enumeration.
- To define id types (for global id definitions)
LinkML describes the process as layering the any_of as additional requirements on top of the range: Any. This works in some cases, but in some export models it treats the Any as a real class and ignores the any_of. The documentation also says "Any or X or Y", which isn't consistent with the described intent- it must be only X or Y. They pydantic model appears to support the any_of, but the python model does not- it includes Any which means anything will pass validation as it's not defining the type limitations.
Our desired state is that the range: Any is completely ignored when the any_of ranges are present- it should appear in no output, including the documentation. All generated artifacts treat the slot as permitting only and everything in the any_of ranges. The pydantic model appears to have this behavior today.
For implementation examples:
1: Subject type, which must be EnumSubjectType or EnumUnknownOther.
2: Organism type, which can be any uriorcurie, but we include EnumOrganism with Human and Mouse for reference.
3: Subject Assertion Global ids, which includes 3 global id types.
For
any_of, we have several major use cases:LinkML describes the process as layering the
any_ofas additional requirements on top of therange: Any. This works in some cases, but in some export models it treats theAnyas a real class and ignores theany_of. The documentation also says "Any or X or Y", which isn't consistent with the described intent- it must be only X or Y. They pydantic model appears to support theany_of, but the python model does not- it includesAnywhich means anything will pass validation as it's not defining the type limitations.Our desired state is that the
range: Anyis completely ignored when theany_ofranges are present- it should appear in no output, including the documentation. All generated artifacts treat the slot as permitting only and everything in theany_ofranges. The pydantic model appears to have this behavior today.For implementation examples:
1: Subject type, which must be EnumSubjectType or EnumUnknownOther.
2: Organism type, which can be any uriorcurie, but we include EnumOrganism with Human and Mouse for reference.
3: Subject Assertion Global ids, which includes 3 global id types.