opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(server): add swagger ui support for api documentation

Open braden-w opened this issue 6 months ago • 3 comments

This PR adds Swagger UI support to the opencode server, providing an interactive API documentation interface.

Changes

  • Added @hono/swagger-ui dependency
  • Integrated Swagger UI middleware at /ui endpoint
  • UI automatically reads from existing OpenAPI spec at /doc

Implementation

I followed the standard Hono Swagger UI documentation approach as shown in their official examples. This provides a clean, minimal integration that leverages our existing OpenAPI specification.

Proposal: support both Swagger UI and Scalar UI

See also #791 which implements Scalar UI on /scalar as an alternative documentation interface. Both UIs can coexist without conflict.

I believe we could support both documentation UIs simultaneously:

  • Swagger UI at /ui - The industry standard that most developers are familiar with
  • Scalar UI at /scalar - A modern alternative with enhanced features

This would give users choice based on their preferences and use cases.

What do you think? Should we support both, or would you prefer to choose one? I'm open to discussion!

CleanShot 2025-07-08 at 21 58 36

braden-w avatar Jul 09 '25 05:07 braden-w

hey, sorry for the delay, giving me two options froze me lol. will discuss with the team this week, we also want to expose openapi docs on the website as well.

adamdotdevin avatar Jul 15 '25 11:07 adamdotdevin

No problem! Yeah sorry if it was overwhelming haha

braden-w avatar Jul 15 '25 19:07 braden-w

No problem! Yeah sorry if it was overwhelming haha

braden-w avatar Jul 15 '25 19:07 braden-w