swagger-api/swagger-codegen

[Java] Getter/Setter naming convention not followed in generated models

開放

#8,282 建立於 2018年6月5日

 (3 則留言) (0 個反應) (0 位負責人)HTML (5,474 個分叉)batch import
Language: javahelp wanted

倉庫指標

星標
 (12,701 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Description

When generating a client library (resttemplate), the getters/setters for a field xField are getXField and setXField. As per naming conventions, this is wrong: https://stackoverflow.com/questions/2948083/naming-convention-for-getters-setters-in-java

We found this issue when testing our API - the responses contained "xfield" and "xField" as jackson serializer did not match the field to the getter generated.

Swagger-codegen version

Using swagger codegen 2.3.1.

Swagger declaration file content or url
		  "xField" : {
			"type" : "string"
		  },
Command line used for generation

Using swagger-codegen-maven-plugin. Maven -> Generate sources

Steps to reproduce

Run generate-sources on a specification containing a field name in some object of form "xField" (a single lower case character followed by upper-case). Generated java model contains getXField() when it should be named getxField().

Suggest a fix/enhancement

Enhance whatever code creates getters and setters for fields in the specification.

貢獻者指南