-
Notifications
You must be signed in to change notification settings - Fork 92
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
text/event-stream
not supported
#1375
Comments
Your trying to do sync push ? I am also doing protocol buffers to open ali for pull and push ( over open api ). Thee is a thing called asyncapi that is designed for openapi but for async . It’s got many more foot guns though . Would love to know your use case |
I'm personally interested in this functionality so that I could generate boilerplate handler code for https://data-star.dev with ogen. What I do currently is that I have two OpenAPI specifications for an application - one API that returns HTML for the GUI and one that returns JSON for M2M communication. With support for |
As a workaround you can use middleware to pass and retrieve the raw request and response objects - #1252. I've tested this approach with https://github.com/starfederation/datastar/tree/main/sdk/go and it works fine. The only issue I found was that Ogen writes an error log saying that there's an superfluous header write once the stream is finished - it doesn't seem to break anything though. |
hey @rokf your use case is identical to mine :) I also use datastar |
What version of ogen are you using?
Can this issue be reproduced with the latest version?
Yes
What did you do?
Consider the following schema. Save it as
openapi.yaml
.Run the following terminal commands
Create a
main.go
file with the following contents.Click to view server implementation
Finally, start the server.
What did you expect to see?
Client can stream the response. e.g.
What did you see instead?
The generated code in
oas_response_encoders_gen.go
looks like the following.Click to view generated code
The call to
io.Copy
prevents streaming of response. This results in clients not receiving data.The text was updated successfully, but these errors were encountered: