You will need bazel
installed, preferably with bazelisk
.
bazel run //server
will build and launch the server on
http://localhost:8080/hi
api contains the CUE specification for the API. It is exported from
CUE into an OpenAPI YAML specification by the build. This is done with rules_cue
.
The YAML specification is then transformed by
oapi-codegen
into a service
handler in Go. This is done with rules_oapi_codegen
.
The service is implemented in server/apiservice, with one
file per resource. The generated code is not in the source tree, as usual with
Bazel and as is familiar with all right-thinking software engineers. But you
can read it in your local workspace under
bazel-bin/server/apiservice/apiservice.go
.
Future work:
- Implement a full resource-oriented API example.
- Implement an aip.dev compatible generator the CUE schema.
- Implement an aip.dev validator for the generated YAML.