FDC3 should avoid union types in contexts and other objects #1105
Labels
api
FDC3 API Working Group
bug
Something isn't working
Context Data & Intents
Contexts & Intents Discussion Group
formal specification
needs-pr
Both Typescript and JSON Schema allow for a type of polymorphism in types and interfaces that is hard to represent in other languages: allowing the type of a variable to be a union of other, unrelated types. E.g.: in typescript
Similar things are possible in JSON Schema by using the
anyOf
oroneOf
keywords to type a field.This can sometimes be handled via a marker interface in another language (e.g. .NET or Java), i.e having a class or interface extend/implement an interface with little or no functionality, just so it can be used as the type for the field, allowing any of the classes that 'implement' it to be set as values. However, this approach is not possible if one of the types in the union is a primitive, meaning it's not a class and can't be modifed, e.g.:
Hence, if FDC3 is intended to be implemented in other languages it should avoid, whereever possible, the use of constructs like this cthat cannot easily be represented in other languages - particularly .NET and Java.
Add guidance/a strong recommendation to the context specification: https://fdc3.finos.org/docs/context/spec#field-type-conventions, https://fdc3.finos.org/docs/supported-platforms and https://fdc3.finos.org/docs/api/spec#desktop-agent-implementation that FDC3 SHOULD NOT use union types or other constructs that are hard to represent in languages other than TypeScript or JSON Schema to ensure ease of implementation in those other languages.
The text was updated successfully, but these errors were encountered: