[JaxRS] compile error with spec without models
Created by: jmini
Description
When you generate a jersey server for a spec that have no model, you can not compile the generated project.
This might be true for other java generated project (java-client, spring?...)
Work-arround: add this section in your spec:
components:
schemas:
SomeObj:
type: object
properties:
someProp:
type: string
openapi-generator version
3.1.0-SNAPSHOT
OpenAPI declaration file content or url
Command line used for generation
Core directly in a java program, with following option:
JavaJerseyServerCodegen config = new JavaJerseyServerCodegen();
config.setJava8Mode(true);
config.setUseBeanValidation(true);
Steps to reproduce
Generate the project. run mvn verify
in the generated project.
You get:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ping-oapigen-jaxrs-jersey: Compilation failure: Compilation failure:
[ERROR] ******/ping-oapigen-jaxrs-jersey/src/main/java/org/openapitools/api/impl/PingApiServiceImpl.java:[4,1] package org.openapitools.model does not exist
[ERROR] ******/ping-oapigen-jaxrs-jersey/src/gen/java/org/openapitools/api/PingApiService.java:[4,1] package org.openapitools.model does not exist
[ERROR] ******/ping-oapigen-jaxrs-jersey/src/gen/java/org/openapitools/api/PingApi.java:[3,1] package org.openapitools.model does not exist
Suggest a fix/enhancement
In the generated code, when there is no models, following import line should be removed:
import org.openapitools.model.*;