Added the eventstream API endpoint#43
Conversation
📝 WalkthroughWalkthroughThis PR introduces a new EventStream API endpoint for fetching device events with streaming and long-polling capabilities, including the OpenAPI operation definition, reusable Event schema with nested structures, and integration into the main API specification. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hey @flrgh, thanks for your first contribution to the project! 🎉 This is a great idea. You're right that SSE support in OpenAPI is a bit tricky, it's not officially part of the 3.0.x spec yet (the OAI is still working on it: https://spec.openapis.org/registry/media-type/sse). That said, I think this addition makes absolute sense for the openhue-api project, as documenting the eventstream endpoint will be valuable for users even if the spec tooling isn't fully there yet. I'm happy to merge this and ship it in the next release. Thanks again for the effort, especially the reverse engineering work on the |
👋
This is an attempt to add a spec for the eventstream API, which can send an SSE streaming response or a singular JSON payload.
This API is documented rather sparingly, so it's difficult to fully spec it out. The bit about
If-None-Matchwas reverse engineered through trial and error.I couldn't figure out how to properly spec out SSE responses in OpenAPI (maybe it's just not possible in 3.0.x?), but I've done my best. The example I included is a snippet of text from a real endpoint with curl, which I think is most helpful to readers. The linter complains about this being a string and therefore not matching the schema, but I have left it as-is and added an ignore rule.
Summary by CodeRabbit
New Features
/eventstream/clip/v2) for device events