[BUG][Java] generator creates inconsistent class name and class file name
Created by: hebra
Description
Trying to generate a Java client from the Vimeo OpenAPI spec. Using the openapi gradle plugin 3.3.4 with the generator 'java with any of it libraries (jersey1, jersey2, feign etc.) generates a class where the file name and the class name are inconsistent in regards to letter cases, leading to java compilation errors.
openapi-generator version
3.3.4
OpenAPI declaration file content or url
config.json
{
"generatorName": "java",
"library": "feign",
"groupId": "com.vimeo",
"modelPackage": "com.vimeo.model",
"apiPackage": "com.vimeo.api",
"invokerPackage": "com.vimeo",
"basePackage": "com.vimeo",
"dateLibrary": "java8",
"java8": true,
"async": true,
"responseWrapper": "ListenableFuture",
"useBeanValidation": true
}
build.gradle snippet
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.openapitools:openapi-generator-gradle-plugin:3.3.4"
}
}
apply plugin: 'org.openapi.generator'
openApiGenerate {
validateSpec = true
configFile = "$rootDir/vimeo/config.json".toString()
inputSpec = "$rootDir/vimeo/openapi/api.yaml".toString()
outputDir = "$buildDir/generated".toString()
}
Command line used for generation
As the OpenAPI generator Gradle plugin is used the command line looks lile
./gradlew clean openApiGenerate
Steps to reproduce
- create a new Spring Boot project (e.g. by using https://start.spring.io/)
- download the api.yaml from above mentioned Vimeo GitHub repo
- adjust the build.gradle to include above additions for the OpenAPI plugin
- run via
./gradlew clean openApiGenerate
Results to check
- after generating open the file
build/generated/src/main/java/com/vimeo/model/MeVideosPrivacy.java
- as you can see from the file name it is
MeVideosPrivacy
with a capital V and P, but inside the file the class name is 'MevideoPrivacy', with a lower-case v but again an uppercase P - some other class files are referencing the class as
MeVideosPrivacy
(likemodel/MeVideos.java
) where others useMevideosPrivacy
(likemodel/InlineObject53.java
Related issues/PRs
Kind of related is #1691
Suggest a fix
I am actually not sure if this is an issue with the Vimeo spec or the OpenAPI generator, as even the naming inconsistency is inconsistent across different files