swagger-api / swagger-api/swagger-codegen
[Angular2] attributes are snake_cased
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
In my generated files, the attribute in the model interfaces are all camelCased, but the fetched data is snake_cased and not changed.
export interface User {
/**
* The ID of the user.
*/
userId: number;
[...]
returned object: { user_id: 12, ... }
Swagger-codegen version
the version used by http://editor.swagger.io/
Notes
However, when sending some formParams (POST) to the server, then the generated code converts the attributes:
if (challengeId !== undefined) {
formParams.set('challenge_id', <any>challengeId);
}
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
Start with the Angular2 generated model interfaces and the response-handling path, then compare them with the shown formParams conversion. The fix is complete when fetched snake_case attributes are converted consistently to the camelCase model properties while the existing form parameter behavior remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100