feat: include package version in default User-Agent#2
Open
Ooscaar wants to merge 1 commit into
Open
Conversation
The generated Configuration.cs hardcoded the User-Agent to "OpenAPI-Generator/1.0.0/csharp", giving us no visibility into which SDK version a client is running. Patch the generated file (in the regeneration workflow, since it's overwritten on every regen) to read the assembly version at runtime, so the default User-Agent becomes e.g. "Zernio/0.0.285" (or "Late/0.0.285" for the legacy package). Also applied to the currently-checked-in Configuration.cs so the change holds until the next regen. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Zernio/0.0.285) instead of the meaninglessOpenAPI-Generator/1.0.0/csharpliteral that the generator hardcodesConfiguration.csis regenerated on every spec change, so the real fix is asedpatch step added to both regeneration paths in.github/workflows/generate.yml(primary Zernio + legacy Late)Configuration.csso the User-Agent is correct between now and the next regenThe version is read at runtime via
typeof(Configuration).Assembly.GetName().Version?.ToString(3), so the User-Agent automatically tracks whatever version the workflow stamps into the csproj — no need to thread the version through codegen.Test plan
src/Zernio/Client/Configuration.cscontains the dynamic User-Agent line (not the OpenAPI-Generator literal)User-Agent: Zernio%2F<version>(URL-encoded, matching prior behavior)🤖 Generated with Claude Code