This directory contains code generation commands for Connexions.
Commands
| Command |
Description |
Documentation |
service |
Generate a service from OpenAPI spec or static files |
docs |
simplify |
Simplify large OpenAPI specs |
docs |
discover |
Discover services and generate imports |
usage |
fakes |
Generate fake function list for docs (internal) |
- |
Quick Start
# Generate a service from an OpenAPI spec
go run github.com/mockzilla/connexions/v2/cmd/gen/service@latest \
-name petstore \
https://petstore3.swagger.io/api/v3/openapi.json
See the documentation for detailed usage.
Discover
Scans a directory for register.go files and generates an imports file for service auto-registration.
# Scan default directory
go run github.com/mockzilla/connexions/v2/cmd/gen/discover@latest
# Scan custom directory
go run github.com/mockzilla/connexions/v2/cmd/gen/discover@latest pkg/services
This generates cmd/server/services_gen.go with imports for all discovered services.
Nested directories are supported:
pkg/
adyen/
v70/register.go → import "module/pkg/adyen/v70"
v71/register.go → import "module/pkg/adyen/v71"
stripe/
register.go → import "module/pkg/stripe"