feat(http): SSE /api/events のイベント型を OpenAPI スキーマに反映 - #39
Merged
Conversation
notedeck#781 Phase 4。ストリーミングイベント envelope 全 11 種 + NoteUpdateBody 系 + chat モデル型に utoipa::ToSchema を付与し、 SSE の data: payload を untagged oneOf (SseEventPayload) として /api/events の response schema に載せる。event: 名と variant の対応は description に記載。従来は "schema is shown as a string" だった。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
なぜ
notedeck-dev/notedeck#781 Phase 4(最終フェーズ)。イベント境界の型契約を SSE / 外部 HTTP API にも反映する。従来
/api/eventsは「OpenAPI cannot model a streaming body, so the schema is shown as a string」で、イベント型は完全に契約外だった。MCP bridge (#513/#555) など外部コンシューマの土台になる。変更内容
NoteUpdateBody系・StreamConnectionState・chat モデル型(ChatMessage/ChatUser/ChatRoom 等)にutoipa::ToSchemaを付与Arc<NormalizedNote>フィールドは#[schema(value_type = NormalizedNote)]で注釈SseEventPayload(untagged oneOf、OpenAPI ドキュメント専用型)を定義し/api/eventsの response body に設定。event:名 ↔ variant の対応表を description に記載テスト
既存 187 件全通過、clippy クリーン。スキーマの実出力は notedeck 側 openapi.json スナップショット再生成で確認する。
🤖 Generated with Claude Code