swagger-api / swagger-api/swagger-codegen

Apex generator = "currency" is also a reserved word

Open
#9,424 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Hello,

swagger-codegen is a great tool.

I have used "currency" as a property name and it is not detected as a reserved word (neither present in this official list: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_reserved_words.htm )

Swagger-codegen version

2.4.5

Swagger declaration file content or url

"Price": {
"type": "object",
"properties": {
"totalPrice": { "type": "number" },
"currency": {"type": "string" }
}
},

Command line used for generation

java -jar swagger-codegen-cli-2.4.5.jar generate -i source/swagger.json -l apex -o c:\swagger\generated

Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

"currency" is not in the list of reserved words for apex:

https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ApexClientCodegen.java

Best regards

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ApexClientCodegen.java and inspect the Apex reserved-word handling for generated properties. Reproduce with the provided Swagger declaration and Java CLI command, then verify that a property named "currency" is handled correctly in the generated Apex output.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.