feat(server): expose openapi and swagger endpoints on http server - #3211
ManthanNimodiya wants to merge 2 commits into
Conversation
Expose OpenAPI 3.0 and Swagger 2.0 specs at /openapi.json, /swagger.json, and /docs endpoints on the HTTP server. Fixes Permify#1714 Signed-off-by: ManthanNimodiya <manthannimodiya989898@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change embeds the OpenAPI 3.0 specification, exposes it at ChangesOpenAPI exposure
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant ContainerRun
participant RegisterOpenAPIHandlers
participant ServeMux
participant OpenAPIJSON
ContainerRun->>RegisterOpenAPIHandlers: register OpenAPI handler
RegisterOpenAPIHandlers->>ServeMux: register GET /openapi.json
ServeMux->>OpenAPIJSON: retrieve embedded JSON
OpenAPIJSON-->>ServeMux: return specification bytes
ServeMux-->>ContainerRun: serve application/json response
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3211 +/- ##
==========================================
- Coverage 76.29% 76.28% -0.01%
==========================================
Files 83 84 +1
Lines 9215 9223 +8
==========================================
+ Hits 7030 7035 +5
- Misses 1635 1638 +3
Partials 550 550 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Remove extra Swagger aliases and unused embeddings to keep the endpoint strictly scoped. Signed-off-by: ManthanNimodiya <manthannimodiya989898@gmail.com>
What & Why
Permify did not expose its OpenAPI/Swagger JSON specifications over HTTP, making integration with API gateways, Swagger UI, and developer portals cumbersome.
This embeds the specifications and registers GET endpoints to serve them directly from the HTTP gateway.
Changes
docs/docs.gofor OpenAPI 3.0 and Swagger 2.0 JSON specifications./openapi.json,/swagger.json, and/docs/...endpoints onruntime.ServeMuxininternal/servers/openapi.goandinternal/servers/server. go.internal/servers/openapi_test.goto validate HTTP response codes, headers, and JSON schemas.Checklist
go build ./...)go test -v ./internal/servers/...)Summary by CodeRabbit
Documentation
/openapi.json.Tests