Skip to content

[ASPNET5] Server Bug - doesn't properly serialize JSON properties in camelCase #3262

@daviddodsworth

Description

@daviddodsworth

It appears as though the ASPNET5 server code gen doesn't preserve the Swagger specified case for models. Specifically, the code gen will always PascalCase all model properties, instead of keeping the "on the wire" original definition.

Version swagger-codegen-2.2.0

Command line used for generation

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l aspnet5 -o samples/server/
petstore/aspnet5

Related issues

Similar to issue #1926 for Typescript.

Suggest a Fix

A suggested fix is to include the [JsonProperty(PropertyName="{{baseName}}"] in the model template definition for ASPNET5. Alternatively the [DataMember] attribute could be used, as is done in the C# client definition.

Will submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions