swagger-api/swagger-codegen

[Angular2] attributes are snake_cased

Aperta

#4774 aperta il 11 feb 2017

 (11 commenti) (9 reazioni) (0 assegnatari)HTML (5474 fork)batch import
Client: TypeScriptIssue: Bughelp wanted

Metriche repository

Star
 (12.701 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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);
}

Guida contributor