swagger-api / swagger-api/swagger-core
Field with first letter lower case not recognized
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 7.5k
- Forks
- 2.3k
- Avg merge
- 18h 1m
- Merged PRs (30d)
- 10
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ModelResolver and reproduce the schema generation for a field named aField with a getter named getaField. Read the JavaBeans Introspector#decapitalize behavior and verify that the generated YAML uses aField rather than getaField; done means the getter is no longer treated as an alternative property name.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100