swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

Field with first letter lower case not recognized

Open Danipiario opened this issue 7 years ago • 1 comments

According to java spec (http://download.oracle.com/otn-pub/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/beans.101.pdf p. 57) the getter for a field like aField (first character in lower case and second character in upper case) is getaField with first letter not modified. In ModelResolver due to #415 the method getaField is treated like an alternative name for the field and the resulting yaml is:

....
    properties:
      getaField:
        type: "string"
....

I can of course annotate getter with ApiModelProperty but IMO this is a bug. You can take advantage of java.beans.Introspector#decapitalize to fix the issue.

Danipiario avatar Sep 19 '18 21:09 Danipiario