swagger-api/swagger-codegen

[Angular2] attributes are snake_cased

Open

#4,774 opened on Feb 11, 2017

View on GitHub
 (11 comments) (9 reactions) (0 assignees)HTML (5,474 forks)batch import
Client: TypeScriptIssue: Bughelp wanted

Repository metrics

Stars
 (12,701 stars)
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