Skip to content

Message payload types should be registered with MessageParser automatically #2

Closed
@daviwil

Description

@daviwil

Right now all message types in Transport.Stdio have to be manually added to a dictionary in the MessageParser class before they can be deserialized correctly. A developer also has to set the right payload type name in their Request/Response/Event class' constructor which is quite easy to forget.

A better solution would be to have an attribute on message classes that defines the payload type name and then use reflection to scan for message types with this attribute. Message types that don't have the attribute should raise an assert in debug builds so that the developer knows that they need to add it. This should solve both problems.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions