OpenAPITools / OpenAPITools/openapi-generator
[REQ] [rust-axum] support text/event-stream
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
Currently, the rust-axum server generator only supports application/json responses. This feature request is for the generator to also support endpoints that respond with a stream or MAY respond with a stream.
Describe the solution you'd like
Ideally, the solution is for the traits created for a route to take into account a return value enum that is either a singular value or is a Box<dyn futures::Stream<Item=T> + Send + 'static> (and potentially Unpin?). Then in the route implementation, I can decide if I stream or not and return the appropriate enum variant.
Describe alternatives you've considered
Do it myself by modifying the generated source code in my project - not currently aware of any other options available within this tool.
Additional context
Filing a new ticket for this after quickly discussing with @linxGnu on another ticket. I am interested in contributing on something like this in order to speed up the process, if possible - but I would definitely need guidance and a little hand-holding. This feels like a larger feature than a regular old “first issue”.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the rust-axum server generator and trace how generated route traits and application/json responses are represented. Compare the requested singular-or-futures::Stream return shape with the current generation behavior. Done means generated routes can support text/event-stream responses as well as singular values, with coverage for both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100