Repository navigation
fix(metadata): publish time.Time as java.util.Date in service definition - #3806
Merged
Merged
Conversation
…generic calls Service definitions publish time.Time as the leaf java.util.Date instead of skipping every method that reaches it. Generic calls handle it the way Java PojoUtils/CompatibleTypeUtils handle Date: - Realize accepts a Date (time.Time), epoch milliseconds, or a "yyyy-MM-dd HH:mm:ss" / RFC 3339 string, at any depth. - The map generalizer returns time.Time unchanged at any depth, so hessian2 writes a Date; it used to become an empty map outside direct struct fields. - The bean generalizer writes it as a primitive java.util.Date descriptor. Fixes apache#3803 Signed-off-by: AsperforMias <asperformias000@outlook.com>
Signed-off-by: AsperforMias <asperformias000@outlook.com>
Signed-off-by: AsperforMias <asperformias000@outlook.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3806 +/- ##
============================================
+ Coverage 46.76% 58.70% +11.93%
============================================
Files 295 492 +197
Lines 17172 40432 +23260
============================================
+ Hits 8031 23734 +15703
- Misses 8287 14920 +6633
- Partials 854 1778 +924 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
AlexStocks
approved these changes
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Fixes #3803
Structs with a
time.Timefield could not be published to the ServiceDefinition, so the whole method was skipped and the service did not show up in Dubbo Admin.This PR maps
time.Timetojava.util.Date, which is what the hessian2 and generic paths already use at runtime:time.Timeis published as ajava.util.Dateleaf type, including pointers, slices and map values. Squashing atime.Timeis still rejected.java.util.Datevalue can be passed as milliseconds,yyyy-MM-dd HH:mm:ss(both matchPojoUtils.realizein Dubbo Java), or an RFC 3339 string (what Go and Admin emit as JSON). Values nested in structs, pointers, slices and maps are realized too. Fractional milliseconds and malformed strings return an error.time.Timeis returned as is at any depth and encoded as Date by hessian2, instead of being expanded into an empty map. The bean generalizer emits a primitive descriptor, matchingJavaBeanSerializeUtil.Verified end to end with Nacos 2.5.2, Dubbo Admin (develop) and the
UserProvidersample from dubbo-go-samples: the service and its methods now appear in Admin withtimeshown asjava.util.Date, and Admin debug invocation and the Go generic client both round-trip the time value in all three formats.Checklist
developmake fmtto format my codemake testto run local tests