https://lakefs.io/ logo
#dev
Title
# dev
a

Ariel Shaqed (Scolnicov)

01/09/2024, 12:13 PM
Hi devs, Bit of an strange question 😕: How do we recommend generating a lakeFS OpenAPI client for Go? Right now I put this in a file `gen.go`:
Copy code
// Package lakefsapi generates code for the lakeFS OpenAPI spec
package lakefsapi

//go:generate go run <http://github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.5.6|github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.5.6> -package apigen -generate "types,client" -o lakefs.gen.go <https://raw.githubusercontent.com/treeverse/lakeFS/v1.4.0/api/swagger.yml>
and then
go generate
builds it for me. Can I do better? In particular, can I somehow use the lakefs version that is already specified in my
go.mod
(for other reasons)?
b

Barak Amar

01/09/2024, 12:37 PM
• We can commit the generated code as we can pull the code with the package. • oapi-codegen can accept yaml with instructions, as alternative to specify the command options • the spec also published in the docs website we can reference it, instead of the github raw, we can provide a link to generate the code or reference the spec from there.
a

Ariel Shaqed (Scolnicov)

01/09/2024, 3:52 PM
Thanks!