This repository contains miscellaneous tools for Flyte contributors.
Because Flyte IDL takes advantage of the grpc-gateway project, the proto file generated by the Swagger gRPC generator is mostly Swagger/OpenAPI compliant. That is, we can run a code generator on top of the OpenAPI spec that's produced. See the file in gen/pb-go/flyteidl/service/admin.swagger.json
.
However, in generating HTTP clients from the publicly available Docker images, we found two issues. The Dockerfile in the swagger-codegen-cli
directory fixes these and the final image is used in the `flyteidl generate script <https://github.com/lyft/flyteidl/blob/master/generate_protos.sh`_.
- GO constant redefinition (detailed here)
- Use version 2.4.0 to solve the pointer struct fields.
To create the image
cd swagger-codegen-cli make docker_build
The Dockerfile
will
- Re-build
swagger-codegen-cli.jar
with the fixed go template using Mavenmvn clean package
. - Follows the pattern in the original CLI to create one with our changes.
Currently, the default host is localhost
for both the clients and the version is 1.0.0
.
The GO client can be tested creating a main file, like
cfg := flyteadmin.NewConfiguration()
cfg.BasePath += ":30081" // default localhost.
client := flyteadmin.NewAPIClient(cfg)
// e.g. This calls the list projects endpoint.
projects, _, err := client.AdminServiceApi.ListProjects(context.Background())