cancel
Showing results for 
Search instead for 
Did you mean: 

Java definition of Resource property with snake_case is generated to camelCase

ThGkatz
New Member

Java definition of Resource property with snake_case is generated to camelCase

Greetings,

 

I'm using the swagger-codegen maven plugin version 2.1.6.

I have a Resource object which needs some properties to be exposed as snake_case. This is required for the communication with an external third party API and cannot change.

 

In my yaml definition I have something like:

ResourceName:

  properties:

    snake_case_property:

      type: string

 

which creates a ResourceName class with the property camelCaseProperty and annotates it with JsonProperty("camelCaseProperty").

 

Is there any way to keep the snake_case? At least in the JsonProperty annotation.

1 REPLY 1
hugomario
Staff

Re: Java definition of Resource property with snake_case is generated to camelCase

Hello,

No really, Java generators are set to work with camel case, any snake case found will be converted to camel case.

 

Currently there is not any option to work with both cases.

New Here?
Join us and watch the welcome video:
Top Kudoed Authors