OpenAPITools / OpenAPITools/openapi-generator
[REQ] More fine-grained specification of http user agent
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
I would like my generated code to send header like <mycompany>/{{packageVersion}}/<language>. Right now, it is either OpenAPI-Generator/{{packageVersion}}/<language> or a provided --http-user-agent string from command line. This string, however, is not subject to further expansion, so I can't provide something like {{mycompany}}/{{packageVersion}}/<language> as a value. What I'd really like is being able to override just the first part while keeping /{{packageVersion}}/<language>.
Describe the solution you'd like
I think templating the first part of the default http-user-agent would actually be sufficient (and easy) solution. I guess it would be better to call the variable {{httpUserAgentIdentifier}} or {{httpUserAgentProduct}}, because these are the terms that RFC 7231 uses. This variable would default to OpenAPI-Generator (so the current hardcoded value) => nothing would change by default.
Describe alternatives you've considered
We could probably also make the value provided by --http-user-agent be a template, so user could provide something like FooBar/{{packageVersion}}/{{language}} on the command line, but I'd be afraid that this approach could open a can of worms as we'd have to start considering all variables a subject to expansion which would lead to more complex code and weird edge cases.
Additional context
None.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the --http-user-agent option and the existing default user-agent handling through the generator. Done means the default remains unchanged while the identifier or product prefix can be customized independently and packageVersion and language expansion still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100