Skip to content

grafeas/client-go

Repository files navigation

Grafeas - Go Client Library

Grafeas is an artifact metadata API. This is a client library in Go that utilizes the Grafeas API.

Generating the Library

The Grafeas client libraries are generated using the standard Swagger (aka OpenAPI) specification. The API is defined once in a JSON file, which is then used to auto-generate libraries for all supported languages at once. This simplifies maintainance and upgrades.

Along with the auto-generated portions of the library, there may be manual changes to the library files. These files are preserved between library generations through the .swagger-codegen-ignore file. Therefore, it is expected that new versions of the library are generated on top of previous ones, to preserve the manual changes.

Regenerating the Library

To generate a new version of the library, run the following command:

go generate

This command will download the latest OpenAPI spec file from the main Grafeas repo, download the necessary version of swagger-codegen, and generate the library using the appropriate configuration options.

Upgrading client library version

The config.go.json sets auto-generation options. When upgrading the client version, make sure to update packageVersion field before running the go generate command. All available options can be found by running:

java -jar swagger-codegen-cli.jar config.go.json -l go

Introducing a breaking change

When introducing a breaking change v2, follow Semantic Import Versioning https://research.swtch.com/vgo-import and append the /v2 to the module path.