swagger-api / swagger-api/swagger-codegen
Clients : invalid variables/functions generated names
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Using swagger codegen with the Fitbit Api results in invalid function names.
For instance, the API with URL:
/1/user/-/activities/date/{date}.json
Is generated with the following name:
1UserActivitiesDateDateJsonGetWithHttpInfo
Which won't compile. I suspect that the '1' in the url is a version number... So I prefixed all affected APIs with 'v', so it becomes:
v1UserActivitiesDateDateJsonGetWithHttpInfo
That is then valid.
I'm running swagger-codegen 2.2.3 on Mac OS X, installed with Homebrew.
To reproduce the issue, launch the following command:
swagger-codegen generate -i https://dev.fitbit.com/docs/explore/fitbit-web-api.swagger.json -l csharp
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
Reproduce the problem with the Fitbit specification and the command swagger-codegen generate -i https://dev.fitbit.com/docs/explore/fitbit-web-api.swagger.json -l csharp. Trace how the C# generator derives operation names from the /1/user/... path, then verify that generated names are valid C# identifiers and compile successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100