swagger-api / swagger-api/swagger-codegen
Apex Petstore sample client errors
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
2 generated client classes (SwagPetApiTest, SwagStoreApiTest) are not compilable due to syntax errors.
Swagger-codegen version
2.2.3
Swagger declaration file content or url
http://petstore.swagger.io/v2/swagger.json
Command line used for generation
java -jar swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l apex
Steps to reproduce
Attempt to deploy SwagPetApiTest, SwagStoreApiTest to a Salesforce org.
Deployment errors as follows (Eclipse Force.com IDE):
Description Resource Path Location Type
Save error: Expression cannot be a statement. SwagPetApiTest.cls src/classes line 139 Force.com save problem
Save error: Expression cannot be a statement. SwagStoreApiTest.cls src/classes line 46 Force.com save problem
Save error: unexpected syntax: 'missing RPAREN at ';'' SwagPetApiTest.cls src/classes line 139 Force.com save problem
Save error: unexpected syntax: 'missing RPAREN at ';'' SwagStoreApiTest.cls src/classes line 46 Force.com save problem
Related issues/PRs
None identified
Suggest a fix/enhancement
Erroring lines in the two classes are the same:
((Swagger.ApiKeyAuth) client.getAuthentication('api_key');
Fixed the client manually by changing the lines to:
client.getAuthentication('api_key');
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the documented Java generation command against the Petstore Swagger URL and inspect SwagPetApiTest and SwagStoreApiTest, especially the reported lines. Done means both generated classes deploy to a Salesforce org without the syntax errors and no longer contain the invalid expression shown in the report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100