Skip to content

Convert IOpenApiDefinitionStorage to IObservable#9625

Merged
michaelstaib merged 6 commits intomainfrom
gai/open-api-observable-storage
Apr 30, 2026
Merged

Convert IOpenApiDefinitionStorage to IObservable#9625
michaelstaib merged 6 commits intomainfrom
gai/open-api-observable-storage

Conversation

@glen-84
Copy link
Copy Markdown
Member

@glen-84 glen-84 commented Apr 30, 2026

No description provided.

Aligns the OpenAPI adapter storage with the MCP adapter pattern by
replacing `event EventHandler? Changed` with
`IObservable<OpenApiDefinitionStorageEventArgs>` carrying granular
Updated/Removed payloads. The registry now subscribes via
`Buffer(500ms, 10)` to coalesce bursts of definition changes into a
single rebuild.
Copilot AI review requested due to automatic review settings April 30, 2026 20:13
@github-actions github-actions Bot added 📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate labels Apr 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the OpenAPI adapter’s storage change-notification mechanism by replacing the Changed event on IOpenApiDefinitionStorage with an IObservable<OpenApiDefinitionStorageEventArgs> stream, enabling reactive subscriptions and batched update handling in the registry.

Changes:

  • Replace IOpenApiDefinitionStorage.Changed event with IObservable<OpenApiDefinitionStorageEventArgs> subscription model.
  • Add storage change event payload types (OpenApiDefinitionStorageEventArgs, OpenApiDefinitionStorageEventType).
  • Update OpenApiDefinitionRegistry to subscribe to the observable and buffer change notifications; update docs/tests accordingly.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
website/src/docs/hotchocolate/v16/guides/openapi-adapter.md Updates guide to describe observable-based change notifications and sample Subscribe implementation.
src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/OpenApiTestBase.cs Updates test storage to implement IObservable subscription mechanics for change notifications.
src/HotChocolate/Adapters/src/Adapters.OpenApi.Core/Storage/OpenApiDefinitionStorageEventType.cs Introduces enum describing storage change types (Updated/Removed).
src/HotChocolate/Adapters/src/Adapters.OpenApi.Core/Storage/OpenApiDefinitionStorageEventArgs.cs Introduces record carrying storage change event data.
src/HotChocolate/Adapters/src/Adapters.OpenApi.Core/Storage/IOpenApiDefinitionStorage.cs Switches interface contract to IObservable<OpenApiDefinitionStorageEventArgs> and updates docs/comments.
src/HotChocolate/Adapters/src/Adapters.OpenApi.Core/OpenApiDefinitionRegistry.cs Subscribes to storage observable, buffers change events, and hardens disposal/update sequencing.
src/HotChocolate/Adapters/src/Adapters.OpenApi.Core/HotChocolate.Adapters.OpenApi.Core.csproj Adds System.Reactive dependency to support buffering/observable operators.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread website/src/docs/hotchocolate/v16/guides/openapi-adapter.md Outdated
@michaelstaib michaelstaib merged commit a3f8384 into main Apr 30, 2026
6 checks passed
@michaelstaib michaelstaib deleted the gai/open-api-observable-storage branch April 30, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants