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
  • #436
Closed
Open
Issue created Jul 02, 2018 by Administrator@rootContributor

[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

https://github.com/OpenAPITools/openapi-generator/blob/001f5ae50d96e9b69e377f136b7fab20e8feba85/modules/openapi-generator/src/test/resources/3_0/ping.yaml

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.*;
Assignee
Assign to
Time tracking