Skip to main content

Create

Write a new endpoint group that builds and passes its tests.

It writes internal/controller/endpoints/<name>/ in the osapi checkout in the current directory, and adds its import to internal/controller/endpoints/all. The group has a list and a get, an empty Deps and the tests of its methods. Then run the steps that it prints. While its Deps is empty, the controller needs no wiring. osapi dsl endpoint spec get lists each part of the DSL.

osapi dsl endpoint create [flags]

Examples​

osapi dsl endpoint create --name trace --description "The traces of the controller"

Result​

The command prints:

$ osapi dsl endpoint create --name trace --description "The traces of the controller"
Endpoint group:
  Name:  trace

Files (5):
  PATH
  internal/controller/endpoints/trace/trace.go
  internal/controller/endpoints/trace/deps.go
  internal/controller/endpoints/trace/methods.go
  internal/controller/endpoints/trace/methods_public_test.go
  internal/controller/endpoints/trace/types.go

Next (4):
  COMMAND
  go generate ./internal/controller/endpoints/all
  mise exec -- just generate
  go test ./internal/controller/endpoints/trace/...
  go run . dsl endpoint validate

With --json, the command prints:

{
"name": "trace",
"files": [
{
"path": "internal/controller/endpoints/trace/trace.go"
},
{
"path": "internal/controller/endpoints/trace/deps.go"
},
{
"path": "internal/controller/endpoints/trace/methods.go"
},
{
"path": "internal/controller/endpoints/trace/methods_public_test.go"
},
{
"path": "internal/controller/endpoints/trace/types.go"
}
],
"next": [
{
"command": "go generate ./internal/controller/endpoints/all"
},
{
"command": "mise exec -- just generate"
},
{
"command": "go test ./internal/controller/endpoints/trace/..."
},
{
"command": "go run . dsl endpoint validate"
}
]
}

Flags​

FlagDescriptionDefault
--descriptionWhat the group is, in one line (required)
--nameThe group's name: its path segment and CLI group (required)

Global flags​

FlagDescriptionDefault
-d, --debugEnable or disable debug mode
-j, --jsonEnable JSON output
-f, --osapi-filePath to config file; without one at the default path, osapi runs on the defaults/etc/osapi/osapi.yaml

Output tells how the result is printed, and what --json gives.