Generate a Go mock server from OpenAPI specs with Connexions.
Each service is a Go package with generated handlers, embedded OpenAPI specs, and optional custom logic.
Includes an API Explorer UI at /api-explorer.
- Click Use this template to create your own repository
- Add services (see below)
- Regenerate and discover:
make generate && make discover - Push to main - binaries for Linux, macOS, and Windows are built automatically and published to Releases
make service name=my-apiThis creates pkg/my_api/ with a scaffold. Replace pkg/my_api/setup/openapi.yml with your spec, then run:
make generate && make discovermake service-from-static name=my-apiAdd response files under pkg/my_api/setup/data/ organized by method and path:
pkg/my_api/setup/data/
get/
users/
index.json -> GET /users
users/{id}/
index.json -> GET /users/{id}
post/
users/
index.json -> POST /users
Then regenerate:
make generate && make discoverEach service lives in pkg/{service_name}/ with:
pkg/petstore/
setup/
openapi.yml # OpenAPI specification
config.yml # Latency, errors, upstream, caching
codegen.yml # Code generation settings
context.yml # Custom values for mock data
generate.go # go:generate directive
gen.go # Generated handler (do not edit)
service.go # Custom logic (optional overrides)
The built-in UI is available at / (configurable in resources/data/app.yml).
It lets you browse services, view specs, test endpoints, and inspect request/response history.
make build
.build/server/serverSee the Connexions docs for more options.