Open byronwolfman opened 4 days ago
I've stumbled upon this exact behaviour yesterday and was really puzzled by it. Glad to have got an explanation.
Note that you can work around this bug by assigning a key to the .
variable first. In the given example, it would look like this:
transforms:
some_transform:
type: remap
inputs:
- demo
source: |
.foo = "bar"
original = object(.)
This will satisfy both validate and test, but feels more like a hack than a real solution.
A note for the community
Problem
I am quoting this excellent comment from @pront which describes how log namespacing affects the type of
.
for transform components, and the implications on theobject()
function:Using the example configuration below,
vector test
will pass all unit tests, butvector validate
will fail on theobject()
function because it knows that log namespacing is enabled, and that.
can be of type anything.Alternatively, you can make the following change to the config:
And now
vector validate
will succeed because this is correct/required, butvector test
will fail because it is unaware that log namespacing is enabled, and it thinks that.
is already an object.Configuration
Version
vector 0.41.1 (x86_64-apple-darwin 745babd 2024-09-11 14:55:36.802851761)
Debug Output
No response
Example Data
No response
Additional Context
With
object()
as per original config:Partial
vector validate
:Partial
vector test
:With
object!()
:Partial
vector validate
:Partial
vector test
:References