Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #1692
Closed
Open
Issue created Dec 17, 2018 by Administrator@rootContributor

[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 (like model/MeVideos.java) where others use MevideosPrivacy (like model/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

Assignee
Assign to
Time tracking