Skip to content

Enhancement: resolving DTOs within an SSE stream the way they resolve in a request response #4179

@robertlagrant

Description

@robertlagrant

Summary

Returning a DTO from a route automatically resolves it into JSON. It would be good to be able to do the same with a DTO yielded out of an SSE endpoint.

I can see two options:

  • LItestar has magic to detect a DTO being yielded, and if it sees that it automatically and pushes it as an SSE event
  • Litestar has a function/method that can be called by the developer to trigger DTO resolution, which can then be yielded

Basic Example

No response

Drawbacks and Impact

Providing the automatic resolution would probably be the simplest approach for the developer, but would lack flexibility. The manual option might be best for now, and adding an automatic alternative in future could be considered when we understand the problem better.

Unresolved questions

Should we do automatic or manual resolution of DTOs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.xThis is related to Litestar version 3EnhancementThis is a new feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions