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
  • #6591
Closed
Open
Issue created Jun 08, 2020 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG] spring generator using maven plugin generates correct code, while cli/gradle generates wrong code

Created by: rivasdiaz

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

I have a simple sample spec. When invoking the generator from maven plugin, code is generated as expected. But both gradle plugin and cli generate a different code.

on the generated interface com.example.api.DefaultApi, when running from Gradle/CLI, this code is generated:

    ResponseEntity<InlineResponse200> getGreetingsMessage(ServerWebExchange exchange);

Which is wrong as it is using reactive classes, which are disabled on the config file.

When using maven plugin, the following code is generated instead:

    ResponseEntity<InlineResponse200> getGreetingsMessage();

which seems to be the correct code.

openapi-generator version

4.3.1

OpenAPI declaration file content or url
openapi: '3.0.3'
info:
  title: 'Greetings API'
  version: '1.0.0'
paths:
  /api/v1/greetings:
    get:
      operationId: getGreetingsMessage
      responses:
        200:
          description: 'A greetings message'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
Command line used for generation
openapi-generator generate \
    --input-spec spec.yaml \
    --config config.json \
    --generator-name spring \
    --output . \
    --invoker-package com.example \
    --api-package com.example.api \
    --model-package com.example.model
Config file used for generation
{
  "useTags": "true",
  "interfaceOnly": "true",
  "hideGenerationTimestamp": "true",
  "sourceFolder": "src/gen/java",
  "java8": "true",
  "library": "spring-boot",
  "dateLibrary": "java8",
  "reactive": "false",
  "useOptional": "true",
  "useBeanValidation": "true",
  "skipDefaultInterface": "true"
}
Steps to reproduce

copy both spec.yaml and config.json to a folder and run open-api-generator-cli as described above.

Related issues/PRs

No related issues I could find.

Suggest a fix
Assignee
Assign to
Time tracking