0

I have a swagger API that I am generating client and server code from.

The client code uses the 'Angular Typescript' option; the server uses the 'node.js' option.

The problem I am having is that the client code models' properties are being generated in camel case (e.g. firstName) and the server models' properties are being generated as pascal case (e.g. FirstName).

The models I have defined inside the spec use pascal case.

Because of the different casings, I am having issues referencing the properties.

Is there a simple way (i.e. not modifying the swagger code gen source) to have the generator respect the names that are defined in the swagger document?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Mike Cheel
  • 12,626
  • 10
  • 72
  • 101

1 Answers1

0

It will be fixed in an upcoming swagger-codegen 2.1.6. There's a commit that allows to change property naming convention.

As a workaround you can also change your server API implementation to support the camel cased property deserialization.

shadeglare
  • 7,006
  • 7
  • 47
  • 59
  • 2 questions please: 1) When do you expect 2.1.6 to release? 2) How do I change the server API implementation? – Mike Cheel Mar 09 '16 at 14:51
  • 1) I'm not aware of swagger release milestones but I think it's not far away. 2) You can adjust your API serializer settings (there's an example for asp.net webapi http://stackoverflow.com/questions/19445730/how-can-i-return-camelcase-json-serialized-by-json-net-from-asp-net-mvc-controll) – shadeglare Mar 09 '16 at 20:11
  • In regards to my question #2 I thought you meant there was a way for the node server code gen to support the camel cased deserialization. I'm generating for client and server apps in this project so no .NET MVC. – Mike Cheel Mar 09 '16 at 20:54