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
istio Timestamp type should be mapped to String type in java #4312
Comments
Hi @yimoucao, |
If the provided code reproduces an issue, i.e. the provided snippet (or any other resource retrieved from the cluster) doesn't get deserialized properly, this should be treated as a bug and fixed. The right approach would be to deserialize the field as a Java Timestamp-compatible type via a Jackson converter/deserializer module, instead of a regular Java String type (which is not very useful for users, especially if they intend to perform operations on the value of the field). However, most of the timestamps we deal with in the client models are currently being deserialized as Strings (See ObjectMeta#creationTimestamp) Since this will involve a breaking change, maybe we can already switch this to use a Java Timestamp-compatible ( |
@manusa I can fix it using Strings fairly quick. If we use a Java Timestamp type, will it require serializer/deserializer change? I'm assuming something has to be done like registering JavaTimeModule and configuring feature flags. To accommodate RFC-3339, extra logic I think has to be written. In sum to fix with a right approach, it's worthwhile to open a new issue and fix all the timestamps not just this Istio one |
Despite not being the most Java friendly way (OffsetDateTime, or other Java Time API types would be much better suited), we're currently mapping Tiemestamps to Strings: Lines 58 to 59 in 711482c
So for consistency reasons, we should stick with mapping Timestamps to Strings. |
Describe the bug
in istio generators, there's such code block that converts istio Timestamp to Long
according to istio doc, it will be marshaled to string in RFC-3339 string
and one example is
lastTransitionTime
on istio offical sitestrings can't be deserialized into java Long type
Fabric8 Kubernetes Client version
6.0.0
Steps to reproduce
copy yaml
and do deserialization with type IstioCondition
Expected behavior
successful deserialization
Runtime
other (please specify in additional context)
Kubernetes API Server version
other (please specify in additional context)
Environment
macOS
Fabric8 Kubernetes Client Logs
Additional context
No response
The text was updated successfully, but these errors were encountered: