finos / FDC3

An open standard for the financial desktop.
https://fdc3.finos.org
Other
194 stars 115 forks source link

Enhancements to messages defined in BrowserTypes #1268

Open Roaders opened 2 months ago

Roaders commented 2 months ago

Enhancement Request

Use Case:

I am a developer implementing a Desktop Agent Proxy that will use the proposed messaging protocol to communicate with a Desktop Agent. The types defined in BrowserTypes are very helpful but there are things that can be done to make things easier.

We have already implemeted a lot of type predicates and union types but I am not sure how useful it would be to contribute these as I understand that the BrowserTypes are generated by magic so that magic should probably also generate the predicates and union types.

kriswest commented 1 month ago

@Roaders There exist AppRequestMessage, AgentResponseMessage and AgentEvent message schemas and types. See:

The types are structurally compatible with all messages derived from them so you can use them to write generalized TypeScript code in your implementation. However, as we generate the TypeScript code from the schemas, the type definitions of specific message types don't formally extend these types - but as TypeScript uses structural compatibility rather than than more traditional declarative typing that should not matter (other than it feeling a little odd to those of us that grew up with OO languages).

Given the number of messages, we should try to avoid creating a manual maintenance situation wherever possible (lest we incur the wrath of future generations of FDC3 maintainers). However, I believe it could/should be possible to come up with a way to generate some of your above suggestions by post processing the BrowserTypes file.

Type detection does seem like something the Convert class could be doing...