Openapi-generator: [BUG] [kotlin-spring] interfaceOnly doesn't work as expected

Created on 30 Jan 2020  路  3Comments  路  Source: OpenAPITools/openapi-generator

Bug Report Checklist

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

Using the openapi-gradle plugin i setup a task to generate code for the Petstore example [YAML] (https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml). I have created the following task:

task buildKotlinClient(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask){
    generatorName = "kotlin-spring"
    inputSpec = "$rootDir/pet.yaml".toString()
    outputDir = "$rootDir/generated-sources/".toString()
    apiPackage = "sandbox.api"
    modelPackage = "sandbox.model"
    configOptions = [
            dateLibrary: "java8",
            swaggerAnnotations: "true",
            interfaceOnly: "true",
    ]
    systemProperties = [
            modelDocs: "false",
            generateSupportingFiles: "false",
    ]
}

From what I understand only the PetAPI and the objects Error and Pet should be generated. Instead the task also generates Application.kt, build.gradle.kts, pom.xml, README.m, settings.gradle and application.yaml

openapi-generator version 4.2.2
gradle version 6.1.1
OpenAPI declaration file content or url

URL: https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml

Steps to reproduce
  1. Download Petstore Example YAML
  2. Run code generation task using the Gradle Plugin
  3. Navigate to the genearted-sources folder
Bug

Most helpful comment

I also run over this issue. generateSupportingFiles is AFAIK specific to the maven plugin.

For the gradle plugin use this:

systemProperties = [
            apis: "",
            models: "",
            supportingFiles: "false"
]

All 3 comments

You can set the "generateSupportingFiles" option to false. It's not specifically related to the kotlin-spring generator. See this answer

I also run over this issue. generateSupportingFiles is AFAIK specific to the maven plugin.

For the gradle plugin use this:

systemProperties = [
            apis: "",
            models: "",
            supportingFiles: "false"
]

Thank you very much for this @kleinph

Was this page helpful?
0 / 5 - 0 ratings