Update the API Reference (OpenAPI Docs)
SkillDocs & knowledgeRegenerate the OpenAPI reference documentation after adding, modifying, or removing API endpoints in sandbox-api. Run this whenever handler signatures, route paths, or swag annotations change.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Update the API Reference (OpenAPI Docs) skill
What this skill tells your AI
The instructions your AI receives, as published by blaxel-ai/sandbox in .agents/skills/update-api-reference/SKILL.md and read by ahel’s review.
The OpenAPI spec is generated from swaggo annotations in the Go handler code. After changing any endpoint, regenerate the docs.
Run the Full Reference Update
make reference
This single command:
- Runs
swag initto parse Go annotations → generatessandbox-api/docs/swagger.yamlanddocs.go - Fixes type name references (replaces
filesystem.DirectorywithDirectory) - Converts Swagger 2.0 → OpenAPI 3.0 via
swagger2openapi - Adds Bearer auth security scheme to all endpoints
- Runs
fixopenapi.shfor additional patches
The output file is sandbox-api/docs/openapi.yml.
How Swag Annotations Work
Annotations are Go comments above handler functions. Example:
// HandleGetFile retrieves a file from the sandbox filesystem.
//
// @Summary Get file or directory
// @Description Returns file content or directory listing
// @Tags filesystem
// @Produce application/octet-stream
// @Param path path string true "File path"
// @Success 200 {string} string "File content"
// @Failure 404 {object} ErrorResponse
// @Router /filesystem/{path} [get]
func (h *FileSystemHandler) HandleGetFile(c *gin.Context) {
Key annotation fields:
@Summary— short description (shown in API reference)@Description— longer explanation@Tags— group endpoints in the UI (filesystem, process, network, codegen)@Param— parameter:name location type required "description"- locations:
path,query,body,header
- locations:
@Success/@Failure— response codes with type and description@Router— path and HTTP method[get|post|put|delete]@Accept/@Produce— request/response content types
Where the Docs Live
| File | Purpose |
|---|---|
sandbox-api/docs/openapi.yml | Final OpenAPI 3.0 spec (commit this) |
sandbox-api/docs/docs.go | Auto-generated Go embed of the spec |
sandbox-api/docs/fixopenapi.sh | Post-processing patches |
After Adding a New Endpoint
- Add swag annotations to your handler function
- Register the route in
sandbox-api/src/api/router.go - Run
make reference - Review the diff in
sandbox-api/docs/openapi.ymlto confirm your endpoint appears correctly - Commit both the handler changes and the updated
openapi.ymlanddocs.go
Verify the Generated Docs
Open the Swagger UI at http://localhost:8080/swagger/index.html while the dev server is running. It reads docs.go which is embedded at build time.
Troubleshooting
swag: command not found: Runmake dependenciesfirst- Missing endpoint in output: Check that your handler has a
@Routerannotation and the function is exported - Type not found: Ensure the struct is in the same package or imported and annotated with
@Description swagger2openapinot found: Runnpm install -g swagger2openapiornpx swagger2openapi(the Makefile usesnpx)
Signals
- GitHub stars
- 28
- Forks
- 15
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
update-api-reference- Source
- github.com/blaxel-ai/sandbox