Closed afolgado closed 4 years ago
As a workaround, it looks like adding "@JsonProperty('needsDescriptionField')" to the trait property solves the problem.
I have confirmed this problem using Scala. (I'm not sure which language you refer to saying "Trait" because your example code does not look like Scala :))
This problem is not fixable in mbknor-jackson-jsonSchema. When looking for jackson-annotatations for a specific property, I use the Jackson-method com.fasterxml.jackson.databind.BeanProperty.getAnnotation().
This method does not return the @JsonPropertyDescription-annotation in this trait-situation. If Jackson (or the language-specific module) returned the annotation, everything would work..
This is possibly related to #105
When using polymorphic classes, the annotation JsonPropertyDescription is ignored when they're implemented via traits. If I use abstract classes, it's working properly.
This is a minimal example. Given the classes:
The method:
outputs:
Please note that the "description field" is correctly transcribed to the schema. Now, if I use traits insteads of abstract classes:
the method:
outputs:
Note that "needsDescriptionField" lacks the "description" field.