Skip to content

API FAQ

API new features are currently in testing. To try them, install the latest goctl version and enable GOCTL_EXPERIMENTAL:

Terminal window
$ goctl env -w GOCTL_EXPERIMENTAL=on

New features are supported starting from version 1.5.1, including:

  1. Data type supports array type
  2. Support Tag Ignore
  3. Pure numbers are supported by routes, e.g. /abc/123/
  4. api resolver migrated from antlr4 to goparser

When enabling new features in 1.5.1, there are some breaking changes to be aware of:

  1. syntax header is required

For data type usage examples, see Type Declarations • Examples.

2. goctl api generated error: multiple service names defined…

Section titled “2. goctl api generated error: multiple service names defined…”

Declares multiple services are not supported in api syntax files such as writing below as unsupported:

service foo {
@handler fooPing
get /foo/ping
}
service bar {
@handler barPing
get /bar/ping
}

The highlighted sections foo and bar show an unsupported pattern; only a single service name is allowed:

service foo {
@handler fooPing
get /foo/ping
}
service foo {
@handler barPing
get /bar/ping
}

Generic and weak types are not supported in api syntax.