Handle normalization of dyn.KindTime
into an any type
#1836
+134
−9
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.
Changes
The issue reported in #1828 illustrates how using a YAML timestamp-like value (a date in this case) causes an issue during conversion to and from the typed configuration tree.
We use the
AsAny()
function on thedyn.Value
when normalizing for theany
type. We only use theany
type for variable values, because they can assume every type. TheAsAny()
function returns atime.Time
for the time value during conversion to the typed configuration tree. Upon conversion from the typed configuration tree back into the dynamic configuration tree, we cannot distinguish atime.Time
struct from any other struct.To address this, we use the underlying string value of the time value when we normalize for the
any
type.Fixes #1828.
Tests
Existing unit tests pass