Skip to main content

apiary

OpenAPI 3.1 for Go: driven by types, not comment soup.

Generate a complete, valid OpenAPIĀ 3.1 document from annotated Go, driven by your types.

// CreateUser registers a new account.
// apiary:operation POST /api/v1/users
// tags: users
// errors: 400,409,500
func (h *UserHandler) CreateUser(
ctx context.Context, req CreateUserRequest,
) (UserDTO, error) {
// business logic; apiary never touches this
}

Types, not comment soup

Function signatures and struct tags are the contract. No schema descriptions duplicated in comments.

Real go/types analysis

Cross-package, imported, and generic types resolve semantically, not guessed from bare names.

Rich schemas for free

validate tags become JSON-Schema constraints. Pointers become nullable. Enums are detected automatically.

Built for clients & CI

Stable operationIds for codegen, JSON or YAML output, and a -check mode that fails on a stale spec.

Honest output

Diagnostics with source positions for bad signatures, typos, unsupported methods and collisions.

Live preview

apiary serve renders Swagger UI that regenerates on every refresh while you edit.