openapi-processor/openapi-processor-spring

Don't add @JsonProperty annotation (configurable)

mjparme opened this issue · 2 comments

It would be nice if there was a configuration option available so we could avoid the redundant @JsonProperty annotation. There is simply no need for the annotation when the value in the annotation is the same as the name of the field. Example:

  @JsonProperty("suffix")
  String suffix

This is simply redundant.

Yes it is redundant. It was just simpler to add it always instead of checking first if the value is a valid java identifier. 😉

I guess it is not too hard to add now with the latest improvements to the identifier handling.

Maybe this does not need an option. It could auto-detect if the name is a valid identifier (or has set the readOnly/writeOnlyproperty) and just add @JsonProperty when it is needed.