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

Set user-agent and package version #86

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

ctreatma
Copy link
Contributor

@ctreatma ctreatma commented Mar 21, 2023

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. To work around this, version.go parses the default User-Agent to extract the package version.

Fixes #72

@ctreatma ctreatma changed the title [WIP] Set user-agent and package version Set user-agent and package version Mar 21, 2023
@ctreatma ctreatma marked this pull request as ready for review March 21, 2023 20:07
metal/v1/version.go Outdated Show resolved Hide resolved
displague
displague previously approved these changes Mar 22, 2023
Copy link
Member

@displague displague left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If my comment about version.go being a template file looks too complex to investigate, let's convert it to an issue to revisit that concern.

That aside, this seems fine.

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.

This also sets the packageVersion parameter to match the version in the
UserAgent, so that the docs display the correct version.
@displague displague merged commit 0061d54 into equinix-labs:main Mar 22, 2023
@ctreatma ctreatma deleted the user-agent branch April 19, 2023 22:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a default User-Agent
2 participants