-
-
Notifications
You must be signed in to change notification settings - Fork 286
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
Add support for model serialization in Socket service #2396
Comments
Hello @derevnjuk This is why there is The best solution his to make the @tsed/schema able to describe websocket/socketio methods (and generate the asyncapi doc also). But it's a big reworks. A quick win cool be to have an decorator interface like the Returns decorator.
You can look the returns.ts file for implementation example ;) See you |
@derevnjuk the #2453 will cover that :) |
@Romakita why don't implement this in the existing version of the package? I can implement this if you don't mind. wdyt? |
@derevnjuk I wanted to completely re-use the package code to reuse the @tsed/schema package as much as possible but I didn't have the time. so it's no longer really relevant. All of stuff described above probably require a huge refactoring of the If you are motivated to implement these feature, let's Go :) |
Information
The Socket service supports real-time communication using decorators like
@Input
,@Emit
, and@Args
. These decorators are used to define the structure and flow of data during communication with the WebSocket. However, there is a limitation when it comes to handling model serialization, specifically when using the@Emit
decorator.Developers will no longer need to manually handle the serialization of complex data models when using the
@Emit
decorator. The proposed feature will handle the serialization process based on the provided serializationExample
We propose adding support for model serialization using the
@Emit
decorator or by inferring the return type of the method decorated by it.Using
@Emit
with explicitly supplied type:Using
@Emit
with Automatic Inference of Return Type:This approach should ensure consistency with the
@Args
decorator, which already allows developers to specify input data structures.The text was updated successfully, but these errors were encountered: