Skip to content

OpenAPI 3.2 Support for Server Sent Events #64379

Closed

Description

@desjoerd

Is there an existing issue for this?

  • I have searched the existing issues

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

No response

Describe the solution you'd like

OpenAPI 3.2 supports sequential media types like Server Sent Events (see https://learn.openapis.org/specification/media-types).
This feature request is to add built-in support for operations returning SseItems (see https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis/responses?view=aspnetcore-10.0#server-sent-events-sse)

Additional context

Requires Microsoft.OpenApi to be updated to 3.x (#64368)

Activity

  1. added
    needs-area-label
    on Nov 15, 2025
  2. MihuBot commented on Nov 15, 2025

    @MihuBot

    I'm a bot. Here are possible related and/or duplicate issues (I may be wrong):

  3. changed the title [-]OpenAPI 3.2 Server Sent Events[/-] [+]OpenAPI 3.2 Supporting Server Sent Events[/+] on Nov 15, 2025
  4. added
    area-minimal
    and removed
    needs-area-label
    on Nov 15, 2025
  5. changed the title [-]OpenAPI 3.2 Supporting Server Sent Events[/-] [+]OpenAPI 3.2 Support for Server Sent Events[/+] on Nov 16, 2025
  6. added this to the .NET 11 Planning milestone on Nov 17, 2025
  7. baywet commented on Feb 20, 2026

    @baywet
    Contributor

    Hi @desjoerd
    Thank you for using the SDK and for reaching out.

    I'm NOT on the ASP.NET team but I work on the OpenAPI standard and the dotnet implementation which ASP.NET relies on to emit the descriptions.

    We've made some progress towards this with #63754 and #65415.

    As far as I understand, this is how SSE is typically implemented in net10 these days

    using System.Net.ServerSentEvents;
    using System.Text.Json;
    
    var builder = WebApplication.CreateBuilder(args);
    var app = builder.Build();
    
    app.MapGet("/sse", () =>
    {
        async IAsyncEnumerable<SseItem<WeatherUpdate>> WeatherStream(CancellationToken ct)
        {
            for (var i = 0; i < 5; i++)
            {
                if (ct.IsCancellationRequested)
                    yield break;
    
                yield return new SseItem<WeatherUpdate>(
                    new WeatherUpdate(
                        TemperatureC: Random.Shared.Next(-10, 35),
                        Condition: "Sunny",
                        Timestamp: DateTime.UtcNow
                    ),
                    "weather-update"
                )
                {
                    EventId = i.ToString()
                };
    
                await Task.Delay(1000, ct);
            }
        }
    
        return TypedResults.ServerSentEvents(
            WeatherStream
        );
    });
    
    app.Run();
    
    public record WeatherUpdate(int TemperatureC, string Condition, DateTime Timestamp);

    Relevant documentation:

    We'd probably need an extension method/attributes to map the event types to event schemas for for discovery.

    In turns, this should assign the ItemSchema property of the response, and result in a description for the operation response that looks something like that:

    There's still some design to do here, but hopefully this is a basis for discussion.

    Let me know if you have any additional comments or questions.

  8. desjoerd commented on Feb 20, 2026

    @desjoerd
    ContributorAuthor

    I will check this :). I think it should be possible based on the info of the Api Explorer.

  9. baywet commented on Jun 29, 2026

    @baywet
    Contributor

    Just put together #67461

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-minimalfeature-openapi

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions