Skip to content

IAsyncEnumerable - JSONL/application/x-ndjson #299

@JohnGalt1717

Description

@JohnGalt1717

Is your feature request related to a problem? Please describe.
I have OpenAI outputting IAsyncEnumerable which my api is outputting IAsyncEnumerable. This is really single line json objects in IAsyncEnumerable. I need a way to annotate the openapi.json file to tell you this and then have the client actually be able to then query the IAsyncEnumerable properly and stream the response.

I have the endpoint tagged with content type of application/x-ndjson which would indicate that it's a stream.

Describe the solution you'd like
I'd like to see this generate IAsyncEnumerable response if the mime type of the response is application/x-ndjson. And then Refit would have to be generating a client from that that could stream the ndjson result.

Describe alternatives you've considered
The only thing I can think of is create a second partial interface and add the endpoint myself to the interface or resulting class library from refit that does this correctly, but then I have manual code to maintain.

Additional context
This is a pretty common issue now because of OpenAI.

Metadata

Metadata

Labels

enhancementNew feature, bug fix, or requesthelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions