microsoft / microsoft/kiota

Implement Server Sent Events for generated clients

Open
#7,435 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:waiting-for-triage type:feature
Dominant language
C#
Stars
3.8k
Forks
333
Avg merge
16h 29m
Merged PRs (30d)
116

Description

### Is your feature request related to a problem? Please describe the problem.

Related to:
https://github.com/microsoft/kiota/discussions/6885 and ultimately release 1.30.0 https://github.com/microsoft/kiota/releases/tag/v1.30.0 that mentions supporting OpenAPI Spec 3.2.0 which include support for SSE.

----

Request:
As an end user of kiota i would like for the clients to handle Server Sent Events (SSE). Fast API recently released support for it officially. https://github.com/fastapi/fastapi/releases/tag/0.135.0

My use case i want to be able to have a python fastapi backend sending SSE to both other python apps and typescript.

---

Example app using kiota 1.30.0
I have spun up a simple setup to help show a few things. https://github.com/zendern/sse-kiota-example
1. the openapi spec doc that is being generated
2. current behavior of kiota generated clients for both typescript/python

### Client library/SDK language

None

### Describe the solution you'd like

Python
---
httpx has support today to stream data back. https://www.python-httpx.org/quickstart/#streaming-responses.

Typescript
---

Unsure here. The native feature is to use EventSource https://developer.mozilla.org/en-US/docs/Web/API/EventSource. But since the default is to use fetch apis not sure how that looks. Its likely more complicated here since the result looks different than normal http traffic of request/response.

---

Ideally in both cases if the header from the openapi spec is text/event-stream it should use the language appropriate solution to make it work.

### Additional context

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the OpenAPI document and generated Python and TypeScript clients in sse-kiota-example as the reproduction starting point. Compare the text/event-stream response with current generated behavior, then review the Python httpx streaming and TypeScript EventSource or fetch options mentioned in the issue. Done means both generated clients provide a language-appropriate way to consume SSE, validated against the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, python, typescript
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.