-
Notifications
You must be signed in to change notification settings - Fork 18
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
property-naming-strategy (and other jackson configurations) not respected #552
Comments
you should not use both features With Micronaut Framework 4.0, you must choose which serialization implementation you want.. I don't expect Micronaut Serialisation to use Jackson configuration such as You can access the Micronaut Serialization configuration reference and Micronaut Serialization docs. |
The issue I reported was for Micronaut 3.10.1 but thanks for your response. I understand Micronaut Serialization does not have a configuration for naming strategy then |
I don't think we do. Do you know @yawkat ? |
currently it can be done on an individual type level but not globally no |
We have even worse issue with Micronaut Serialization feature. We have JDBI as a ResultSet to POJO mapper and extensively using PG json functions. The problem is databases are usually snake cased, so we are injecting a copy of Jackson ObjectMapper with custom SNAKE_CASE strategy in Micronaut3 microservices. With Micronaut's ObjectMapper is totally impossible by design (it reads @Serdeable annotation to determine strategy - and we use default for anything except database interaction). Can we get back the ability to globally override strategy for concrete ObjectMapper instance? |
Expected Behavior
Micronaut Serialization module should respect Jackson property naming strategy settings (from application.yml) when serializing/deserializing POJOs
Actual Behaviour
Micronaut ignores Jackson settings
Steps To Reproduce
mn create-app --build=gradle --jdk=17 --lang=java --test=junit --features=serialization-jackson,jackson-databind com.example.demo
jackson.property-naming-strategy: SNAKE_CASE
toapplication.yml
curl -X POST 'http://localhost:8080/hello1' -H 'Content-Type: application/json' -d '{"first_name": "John"}'
{"message":"Bad Request","_links":{"self":[{"href":"/hello1","templated":false}]},"_embedded":{"errors":[{"message":"Failed to convert argument [req] for value [null] due to: Unable to deserialize type [Hello1Request req]: Null argument specified for [firstName]. If this argument is allowed to be null annotate it with @Nullable","path":"/req"}]}}%
curl -X POST 'http://localhost:8080/hello1' -H 'Content-Type: application/json' -d '{"firstName": "John"}'
Hello1, John
Environment Information
Example Application
No response
Version
3.10.1
The text was updated successfully, but these errors were encountered: