Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FDC3 should avoid union types in contexts and other objects #1105

Closed
kriswest opened this issue Nov 13, 2023 · 1 comment · Fixed by #1200
Closed

FDC3 should avoid union types in contexts and other objects #1105

kriswest opened this issue Nov 13, 2023 · 1 comment · Fixed by #1200
Labels
api FDC3 API Working Group bug Something isn't working Context Data & Intents Contexts & Intents Discussion Group formal specification needs-pr

Comments

@kriswest
Copy link
Contributor

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

type Example = SomeOtherType | YetAnotherType;

Similar things are possible in JSON Schema by using the anyOf or oneOf 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.:

type Example2 = SomeOtherType | string;

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.

@kriswest kriswest added bug Something isn't working api FDC3 API Working Group formal specification Context Data & Intents Contexts & Intents Discussion Group labels Nov 13, 2023
@kriswest
Copy link
Contributor Author

@bingenito please feel free to add anything on your experience with this to the issue. I'll add it to the next SWG meeting agenda to discuss/vote on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api FDC3 API Working Group bug Something isn't working Context Data & Intents Contexts & Intents Discussion Group formal specification needs-pr
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant