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
  • #3367
Closed
Open
Issue created Jul 15, 2019 by Administrator@rootContributor

[BUG][R] Generating R enums results in empty class with no values

Created by: Leo-Rutschmann

Description

I have noticed that R enums are not generated properly, that is, instead of a proper enum structure, an empty class is generated. In it, there is nothing but the to-/fromJSON-methods; the values of the enum - that are specified in the schema - are not present.

openapi-generator version

openapi generator 4.0.1 (gradle plugin)

OpenAPI declaration file content or url

generated with json Schema:

{
  "openapi": "3.0.0",
  "info": {
    "title": "JSON test",
    "version": "1.0.0-SNAPSHOT"
  },
  "paths": {
  },
  "components": {
    "schemas": {
      "EnumTest": {
        "enum": [
          "One",
          "Two",
          "Three"
        ],
        "type": "string"
      }
    }
  }
}
Command line used for generation

task generate_R_test(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) { inputSpec = "$rootDir/src/schema/new/test.schema.json".toString() outputDir = "$rootDir/src/data/r_model/test".toString() generatorName = 'r'

systemProperties = [
    models: "", // generate only models, but all of them
]

}

Steps to reproduce
  1. use the gradle plugin with the above command to generate the enum
  2. open the enum file (enum_test.R)
  3. see that it generates an empty class without any of the enum values
Related issues/PRs

I have seearched for this issue but not found a similar case for R (only for Javascript, see https://github.com/swagger-api/swagger-codegen/issues/4819, but I do not know how helpful that will be)

Suggest a fix

I am not really familiar with the whole code, but upon looking at the code, I think the problem is that model.moustache is also used to generate enums. Because the values are described differently in the Schema, they might not be recognised properly

Assignee
Assign to
Time tracking