Skip to content

feat: include package version in default User-Agent#2

Open
Ooscaar wants to merge 1 commit into
mainfrom
feat/user-agent-package-version
Open

feat: include package version in default User-Agent#2
Ooscaar wants to merge 1 commit into
mainfrom
feat/user-agent-package-version

Conversation

@Ooscaar

@Ooscaar Ooscaar commented May 26, 2026

Copy link
Copy Markdown
Member

Summary

  • Default User-Agent now reports the actual SDK version (e.g. Zernio/0.0.285) instead of the meaningless OpenAPI-Generator/1.0.0/csharp literal that the generator hardcodes
  • Configuration.cs is regenerated on every spec change, so the real fix is a sed patch step added to both regeneration paths in .github/workflows/generate.yml (primary Zernio + legacy Late)
  • Also applied the same change to the currently checked-in Configuration.cs so the User-Agent is correct between now and the next regen

The 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

  • CI builds green on this branch
  • After merge, trigger a regenerate run and confirm the regenerated src/Zernio/Client/Configuration.cs contains the dynamic User-Agent line (not the OpenAPI-Generator literal)
  • Confirm an outbound request from a built client sends User-Agent: Zernio%2F<version> (URL-encoded, matching prior behavior)

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant