Closed ghostbuster91 closed 1 month ago
I don't want to change the default behaviour of serialising as much information as possible, which prevents loss of information. Generally speaking, I think tools ought to abide by some level of lenience when it comes to de-serialisation, but provide as much info as available when it comes to serialisation. I'm happy to accept changes of behaviour that go in that direction, but not willing to make changes that go in the other direction.
That being said :
Timestamp.nowUTC
to only capture millisecond/seconds precision. Or alternatively add truncateMillis
and truncateSeconds
, to make it easier to mitigate problems, if they ever arise. I like the ability to customize and a truncateMillis
+ truncateSeconds
addition. Timestamps often come from something like CE's Clock so nowUTC
alone won't do the trick.
Actually, truncateMillis
and truncateSeconds
- these would be alloy traits, or methods on Timestamp? (@ghostbuster91 enlightened me and now it seems like you meant traits)
I meant methods on Timestamp for starters, but we could later on create corresponding traits. I wouldn't want to pull that trigger unless there's a non-hypothetical scenario that'd warrant it.
Long story short the change in https://github.com/disneystreaming/smithy4s/pull/1576 prompted me to review in details
timestamp
datatype andtimestampFormat
trait.According to smithy documentation:
and timestamp format docs
For
date-time
andepoch-seconds
:For
http-date
:Base on the above I propose following changes:
timestampFormat=http-date
the value should be truncated to second precision during the serializationtimestampFormat=date-time | epoch-seconds
the value should be truncated to millisecond precision during the serialization