-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Annotations in mix-ins added to ObjectMapper are not considered by the generator #411
Comments
Hi @bmaizel, Three thoughts on this:
Will you approach Tatu through https://github.com/FasterXML/java-classmate? |
Hi @CarstenWickner, I could do it, but you can do it better (please!). You definitely have much deeper understanding of the problem, and your code is going to use the (new) functionality, so better you start the discussion. Of course I will follow, and I will try to help if I see how. |
Hi @bmaizel, I had a brief look into the Line 146 in ea90e6c
The third parameter on the classmate MemberResolver.resolve() method is of type AnnotationOverrides .Currently, I'm always sending null . But providing an AnnotationOverrides instance would allow mix-ins to be respected.
Perhaps creating a subtype of the |
I've raised the question now: FasterXML/java-classmate#81 |
Subscribed. |
One challenge at a time. 😆 |
I have a workaround 😆 |
I expected, that if I add a mix-in (with
ObjectMapper.addMixIn()
orObjectMapper.setMixInResolver()
) to theObjectMapper
instance and supply it to theSchemaGeneratorConfigBuilder
constructor, it will be considered by the generator. (Yes, I know that this expectation is not supported by the documentation :)It partially works. Mix-ins are considered during introspection, so, per example, adding
@JsonProperty
annotation via mix-in can make the annotated field visible to the generator. But the annotation access methods in theFieldScope
andMethodScope
do not consider mix-ins. So adding@JsonProperty("changedName")
to the mix-in will not affect the property name in the generated schema.I believe, it would be good to support mix-ins in the
FieldScope
,MethodScope
andTypeScope
.For a while I can live with a workaround, which is hacky and shaky, and I would like to remove it:
The text was updated successfully, but these errors were encountered: