Swagger is unable to fetch the right variable name in the API Request Documentation
If a variable name starts with a single character followed by camel casing (aSideName), then the swagger is not able to translate the name properly. Instead it pulls the getter method of the variable (getaSideName) and shows it as the input in the swagger page. So, the API won't work now since the field name is wrong. Language: Java
This is an issue introduced by #415 (btw the same problem appears in #2332). The name of the property is sanitized to avoid cluttering it (for example getId doesn't become getGetid) but there are too many exceptions.
It would be great if one of the maintainers could share some thoughts and see if we can change the approach (fixing the current logic seems not the right way as there would be always cases not considered.
A quick fix that I found is to use the @jsonproperty annotation. This results in the swagger picking up the variable name as it is. But, we mostly do not add the annotation for the variables in the DTO class unless we require it for a specific purpose. I think the swagger should be able to identify the variable names perfectly.
Another weird thing that I noticed is that if we rename the getter slightly then it works too.
Ex: updating the getter for the variable aSideName from the default IDE generated format of getaSideName() to getASideName().
The code checks for a get method with a lowercase letter after that (ie getaSideName), this is a fix introduced some time ago but clearly not covering every case.
The jsonproperty is the way to go, however swagger-core should (in my opinion) not try to guess/update the variable name but read as is.