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
  • #13705
Closed
Open
Issue created Oct 16, 2022 by Administrator@rootContributor4 of 4 checklist items completed4/4 checklist items

[BUG][gradle plugin] User-defined templates do not work with the gradle plugin

Created by: whydoievenneedthis

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
Description

Following the instructions from the documentation: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/templating.md

I got the CLI, created the following config.json file:

{
  "generatorName": "typescript-angular",
  "inputSpec": "spec.json",
  "outputDir": "gen",
  "templateDir": "templates",
  "files": {
    "AUTHORS.md": {}
  }
}

Created the templates directory, added an empty AUTHORS.md file and executed the following command: openapi-generator-cli generate -c config.json

This resulted in the expected generated typescript projet, witht he additional AUTHORS.md file.

Afterwards I tried to make the same change to my gradle configuration:

    task("openApiGenerateClient_spec", type: GenerateTask, group: 'openapi subtasks') {
        generatorName = "typescript-angular"
        inputSpec = "spec.json"
        outputDir = "gen"
        // lines below are newly added
        templateDir = "templates"
        files = {
            AUTHORS.md = {}
        }
    }

However, when I now run this task, I get the following error:

> Could not set unknown property 'files' for task ':openApiGenerateClient_spec' of type org.openapitools.generator.gradle.plugin.tasks.GenerateTask.

Which corresponds to the GenerateTask not having a files property: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt

openapi-generator version

6.2.0

Assignee
Assign to
Time tracking