Skip to content

[BUG][JAVA] RestTemplate uses hardcoded User-Agent Java-SDK #21972

@Semenchikus

Description

@Semenchikus

Bug Report Checklist

  • [V] Have you provided a full/minimal spec to reproduce the issue?
  • [V] Have you validated the input using an OpenAPI validator?
  • [V] Have you tested with the latest master to confirm the issue still exists?
  • [V] Have you searched for related issues/PRs?
  • [V] What's the actual output vs expected output?
    Actual: when generating API client with RestTemplate library and custom User-Agent in xml configuration, generated API client has hardcoded User-Agent.
    Expected: when custom User-Agent is set, the API client uses it.
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
openapi-generator version

7.15.0

openapi-generator-maven-plugin

Steps to reproduce
  1. Define any OpenAPI service.
  2. Use the following config in your pom.xml:
<plugin>
   <groupId>org.openapitools</groupId>
   <artifactId>openapi-generator-maven-plugin</artifactId>
   <version>7.15.0</version>
      <executions>
         <execution>
            <id>generate-my-api-client</id>
            <goals>
               <goal>generate</goal>
            </goals>
            <configuration>
               <library>resttemplate</library>
               <httpUserAgent>${project.name}/${project.version}</httpUserAgent>
            ...
Related issues/PRs

Suggest a fix

Going to prepare a PR now

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions