ScaCap / spring-auto-restdocs

Spring Auto REST Docs is an extension to Spring REST Docs
https://scacap.github.io/spring-auto-restdocs/
Apache License 2.0
312 stars 86 forks source link

OffsetDateTime #147

Closed ssozonoff closed 7 years ago

ssozonoff commented 7 years ago

Hi All,

What would be the correct way to deal with a field of type OffsetDateTime

Currently it is being completely enumerated which I dont want.

` scheduledTimeForOrderAsIso8601 Object true  
scheduledTimeForOrderAsIso8601.offset Object true  
scheduledTimeForOrderAsIso8601.offset.totalSeconds Integer true  
scheduledTimeForOrderAsIso8601.offset.id String true  
scheduledTimeForOrderAsIso8601.offset.rules Object true  
scheduledTimeForOrderAsIso8601.offset.rules.fixedOffset Boolean true  
scheduledTimeForOrderAsIso8601.offset.rules.transitions Array true  
scheduledTimeForOrderAsIso8601.offset.rules.transitions[].offsetBefore Object true  
scheduledTimeForOrderAsIso8601.offset.rules.transitions[].offsetAfter Object true

...... cut the remainder but you get the idea `

Kind thanks, Serge

jmisur commented 7 years ago

you need your own serializer if jackson doesn't support that type out of the box. Have a look at https://github.com/ScaCap/spring-auto-restdocs/blob/master/spring-auto-restdocs-example/src/main/java/capital/scalable/restdocs/example/jackson/MoneySerializer.java And register it when constructing ObjectMapper https://github.com/ScaCap/spring-auto-restdocs/blob/master/spring-auto-restdocs-example/src/main/java/capital/scalable/restdocs/example/jackson/JsonConfiguration.java

jmisur commented 7 years ago

Were you able to succeed with my pointers?

ssozonoff commented 7 years ago

All good thank you.