OpenAPITools / OpenAPITools/openapi-generator

[BUG][JAVA] field names convention not respected in response model

Open
#16,858 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

Hello Everyone. I'm using maven plugin openapi-generator-maven-plugin in version 6.6.0 to generate pojo models based on provided Swagger 2.0 which describes some REST api with response body which contains fields with field names given in UpperCamelCase convention

even though model seems to be generated correctly, at least under serialized name:

while setting actual values in response model, I can see in debug and also while testing in Postman that it's actually using standard camel case convention. It seems it's using variable name, not serialized name.

openapi-generator version

6.6.0

OpenAPI declaration file content or url
		<plugin>
			<groupId>org.openapitools</groupId>
			<artifactId>openapi-generator-maven-plugin</artifactId>
			<version>6.6.0</version>
			<executions>
				<execution>
					<id>transactions</id>
					<goals>
						<goal>generate</goal>
					</goals>
					<configuration>
						<inputSpec>${project.basedir}/src/main/resources/Transactions.json</inputSpec>
						<generatorName>java</generatorName>
						<strictSpec>true</strictSpec>
						<configOptions>
							<sourceFolder>src/gen/java/main</sourceFolder>
							<identifierNamingConvention>original</identifierNamingConvention>
						</configOptions>
						<generateApis>false</generateApis>
						<apiPackage>transactions</apiPackage>
						<modelPackage>transactions</modelPackage>
					</configuration>
				</execution>
			</executions>
		</plugin>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with the openapi-generator-maven-plugin 6.6.0, the Java generator, and the referenced Transactions.json Swagger 2.0 input. Inspect the generated response model and its serialization behavior; done means UpperCamelCase schema field names remain consistent when values are assigned and serialized.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.