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
  • #2616
Closed
Open
Issue created Apr 06, 2019 by Administrator@rootContributor0 of 1 checklist item completed0/1 checklist item

[BUG][APEX] Enum values can conflict with keywords as Apex is case-insensitive

Created by: arangari

Bug Report Checklist

  • [YES ] Have you provided a full/minimal spec to reproduce the issue?

  • [YES] Have you validated the input using an OpenAPI validator (example)?

  • [YES] What's the version of OpenAPI Generator used?

  • [Yes ] Have you search for related issues/PRs?

  • [ YES] What's the actual output vs expected output?

  • [Optional] Bounty to sponsor the fix (example)

Description

take example of a API specifications for CUFX 4.1. A part of this specs is as below:

"billStatus": {
         "description": " [AHR] omit ",
         "enum": [
           "Due",
           "OverDue",
           "Cancelled",
           "Suspended",
           "Paid",
           "Void",
           "Dispute",
           "PaymentFailed"
         ],
         "type": "string"

The value 'Void' will conflict with keyword 'void'. The generated output is as below:

    public enum BillStatusEnum {
        DUE,
        OVERDUE,
        CANCELLED,
        SUSPENDED,
        PAID,
        VOID,
        DISPUTE,
        PAYMENTFAILED
    }

This issue is continuing from Swagger 2.0 as I tried with that first and then now with OAS3.0.

Also, the maximum enums one can define is 100. This creates the problem in the enums for say Countries.

openapi-generator version

OAS 3.0 (Git Clone at 25d39c36)

OpenAPI declaration file content or url

I am trying to generate client coe for below . https://app.swaggerhub.com/apis/dlacroix01/CUFX/4.1

Command line used for generation

java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i ~/Downloads/swagger-client-generated-2/swagger.json -g apex -o ./ClientsApex/CUFX4.1/

Steps to reproduce

After code is generated, try to deploy the code on salesforce org.

Related issues/PRs
Suggest a fix

There can be multiple approaches.

  1. I created class which has constant strings for the enum. The problem is with JSON serialize/deserialize.
  2. using globalpicklist/valueset as these will be useful. However the type-checking cant be performed, as we wouldnt be saving any objects. Also there are governor limits [https://help.salesforce.com/articleView?id=fields_creating_global_picklists.htm&type=5] We may have to brainstorm here.
Assignee
Assign to
Time tracking