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
Groovy metaClass not ignored when model is built for deserialization #752
Comments
You should probably apply a mix in to all your groovy models with the |
This does not help |
Weird. Do you have an example repo? Another thing u could try is to add the groovy |
Do you mean Docket.ignoredParameterTypes. It says:
Should there be something else? |
Yes, u can add the groovy Metaclass to the ignorables using that method. |
I think this method does what JavaDoc says, ignores parameter types, not On Mon, May 25, 2015 at 11:18 PM, Dilip Krishnan notifications@github.com
|
Tried one more thing:
still same effect. Also changing MetaClass to String affects serialized properties, but not Swagger documentation. |
I've added tests that demonstrate there is no issue in the library as-is. I suspect you've customized your ObjectMapper which in turn is causing the groovy meta class to show |
it seems to me that this test does not test problematic case. I'm having issue with de-serialization, so you need to use that Groovy model as request body, not response. |
I think I know why global mix in has no effect. Spring Boot has multiple MappingJackson2HttpMessageConverter converters. One is default, registered by AllEncompassingFormHttpMessageConverter. Another one is added by JacksonAutoConfiguration. As a result, FieldModelPropertyProvider.onApplicationEvent is called multiple times and last wins. Unfortunately, this is not the one from JacksonAutoConfiguration. Maybe ObjectMapperConfigurer should handle only primary one? |
Thanks for pursuing the issue. This should now be fixed |
…erage build issue Uncovered the fact that the field model properties provider was working incorrectly. This fixes that problem also removed some ignored tests. related to #752
Thanks for fixing. Any plans to release it soon? |
Hopefully end of this week |
Verified that ignoredParameterTypes(MetaClass) does the job. However, there is still an issue with picking wrong ObjectMapper, which I believe is the root cause. Any mix ins or other configuration applied to correct ObjectMapper will be ignored. |
@aleksz have you used the guidance in the docs to configure the ObjectMapper? If you do it that way or create ObjectMapper using the Jackson2ObjectMapperBuilder you shouldn't run into that issue. |
exclude metaClass properties for groovy model classes in swagger: |
When I have only "get", in my controller - MyResource does not have metaClass. As soon as I add "save", metaClass appears in both calls.
swagger-annotations:1.5.3-M1
swagger-model:1.5.3-M1
springfox-swagger2:2.0.0
jackson:2.4.5
Tracked to this code in BeanModelPropertyProvider:
In both cases introspect returns metaClass description
The text was updated successfully, but these errors were encountered: