Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Models classes generated by openapi-generator have unknown imports #11010

Closed
1 task
avdev4j opened this issue Dec 20, 2019 · 2 comments · Fixed by #11011
Closed
1 task

Models classes generated by openapi-generator have unknown imports #11010

avdev4j opened this issue Dec 20, 2019 · 2 comments · Fixed by #11011

Comments

@avdev4j
Copy link
Contributor

avdev4j commented Dec 20, 2019

Overview of the issue

Hi team,
when we use the openapi-generator (wrapped by our openapi-client subgenerator) the generated classes import the following class import org.openapitools.jackson.nullable.JsonNullable;.

The problem is that we don't have the org.openapitools.jackson dependency in our pom.

After some research it's appeard that this bug is known by the openapi community, but no fix has been done yet. OpenAPITools/openapi-generator#2901

Motivation for or Use Case
Reproduce the error

run the subgenerator openapi-client with an openapi spec api.yml

Related issues
Suggest a Fix

I suggest to add the dependency when using our openapi-client. It's not really smart, but at least the generated code can be compiled and run. We can also add a comment in the code to link the openapi-generator issues and remember why we did the hack.

I know this a hack and I don't have a fully satisfying solution.

Otherwise the solutions suggested by the community are :

JHipster Version(s)
[email protected] /Users/aviard/projects/perso/consumeApiWorkshop
└── (empty)

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "io.github.openapiworkshop",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "6.5.1",
    "applicationType": "monolith",
    "baseName": "consumeApiWorkshop",
    "packageName": "io.github.openapiworkshop",
    "packageFolder": "io/github/openapiworkshop",
    "serverPort": "8081",
    "authenticationType": "jwt",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "postgresql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "bXktc2VjcmV0LXRva2VuLXRvLWNoYW5nZS1pbi1wcm9kdWN0aW9uLWFuZC10by1rZWVwLWluLWEtc2VjdXJlLXBsYWNl",
    "embeddableLaunchScript": false,
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "angularX",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en"
    ],
    "blueprints": [],
    "openApiClients": {
      "openApiWorkshop": {
        "spec": "../openApiWorkshop/src/main/resources/swagger/api.yml",
        "generatorName": "spring"
      }
    }
  }
}
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

Environment and Tools

openjdk version "1.8.0_202"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_202-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.202-b08, mixed mode)

git version 2.19.0

node: v10.13.0

npm: 6.5.0

yeoman: 2.0.5

yarn: 1.13.0

Docker version 19.03.4, build 9013bf5

docker-compose version 1.24.1, build 4667896b

Entity configuration(s) entityName.json files generated in the .jhipster directory

N/A

Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
@pascalgrimaud
Copy link
Member

@avdev4j : plz, don't forget to update the area + theme label, to have better visibility, rather than letting the default undefined labels

@PierreBesson
Copy link
Contributor

@avdev4j I agree with you that the dependency need to be added dynamically to the existing app. Maybe we can use the existing jhipster hooks that are used by blueprints to add a dependency.

@pascalgrimaud pascalgrimaud added this to the 6.7.0 milestone Jan 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants