Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Set user-agent and package version
Browse files Browse the repository at this point in the history
The openapi-generator has a parameter to specify the default UserAgent
for the generated code so we don't have to duplicate the metal-go UA in
client projects.

The generator also supports a package version parameter, but the value
only gets written to the API.md doc, so client projects can't read the
version.
  • Loading branch information
ctreatma committed Mar 21, 2023
1 parent 6e7ef1b commit 207f86a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion API.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ To exclude resources, and optimize response delivery, use the `exclude` query pa
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 1.0.0
- Package version: 1.0.0
- Package version: 0.7.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen

## Installation
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ GIT_ORG=equinix-labs
GIT_REPO=metal-go
PACKAGE_PREFIX=metal
PACKAGE_MAJOR=v1
PACKAGE_VERSION=0.7.0
CRI=docker # nerdctl

OPENAPI_GENERATOR=${CRI} run --rm -u ${CURRENT_UID}:${CURRENT_GID} -v $(CURDIR):/local ${OPENAPI_IMAGE}
Expand Down Expand Up @@ -59,7 +60,9 @@ clean:
gen:
${OPENAPI_GENERATOR} generate -g go \
--package-name ${PACKAGE_MAJOR} \
--http-user-agent "${GIT_REPO}/${PACKAGE_VERSION}" \
-p isGoSubmodule=true \
-p packageVersion=${PACKAGE_VERSION} \
--model-package types \
--api-package models \
--git-user-id ${GIT_ORG} \
Expand Down
2 changes: 1 addition & 1 deletion metal/v1/configuration.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 207f86a

Please sign in to comment.