question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@JsonFormat does not work with Graalvm + quarkus-resteasy-reactive-jackson

See original GitHub issue

Describe the bug

I have a data class with a OffsetDateTime.

data class MyData( @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ssZ", timezone = "UTC") val myTime: OffsetDateTime) When running under Java the serialization works, in native mode it doesn’t.

Expected behavior

{ "myTime": "2021-03-10T19:15:00+0000" }

Actual behavior

{ "myTime": 1615403700.000000000 } Environment (please complete the following information):

  • GraalVM version: 21.0.0
  • Quarkus version or git rev: 1.12.2.Final
  • Build tool (ie. output of mvnw --version or gradlew --version): Gradle 6.6.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
geoandcommented, Mar 12, 2021

Maybe here? https://quarkus.io/guides/rest-json#jackson .

Currently there is no Kotlin in those guides, but if we do add Kotlin examples at some point, we will certainly consider this.

But I still think this is a bug. Isn’t it possible to get it to work?

There is nothing Quarkus can do about this. It has to do with the bytecode Kotlin produces and how Jackson handles the annotation lookups

0reactions
holledauercommented, Mar 12, 2021

Maybe here? https://quarkus.io/guides/rest-json#jackson .

But I still think this is a bug. Isn’t it possible to get it to work? We are using the annotation in multiple quarkus and spring projects and it works everywhere without the the field specifier.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Native image doesn't respect date format with @JsonFormat
Update: I made mi own serializer and still doesn't work. I added one log to see if it goes through that class. When...
Read more >
Assisted Configuration with Tracing Agent - GraalVM
The generated files are standalone configuration files in JSON format which contain all intercepted dynamic accesses. It can be necessary to run the...
Read more >
JsonFormat (jackson) not working when no explicity @Body ...
When trying to use @Body annotation we can't use @RequestBean due to the bean is replaced with a new instance to fill body...
Read more >
Native Image Build Configuration - Oracle Help Center
The generated files are standalone configuration files in JSON format which contain all intercepted dynamic accesses. It can be necessary to run the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found