Closed parsnips closed 7 months ago
Describe the bug When executing the has macro on nested paths, will throw a no such key error instead of false.
has
false
Consider the following json in context as doc
doc
{ "fizz": { "buzz": { "baz": "biz" } } }
if you execute the following has macros:
has(doc.fizz.buzz.baz)
true
has(doc.fizz.baz)
has(doc.fizz.baz.buzz)
has(document.fizz.baz.buzz)
Expected behavior
Expect has macro to return false instead of an error.
The has macro only operates on the last field in the field selection. If you're looking for a more robust check, consider using optional types: doc.?fizz.baz.buzz.hasValue()
doc.?fizz.baz.buzz.hasValue()
Describe the bug When executing the
has
macro on nested paths, will throw a no such key error instead offalse
.Consider the following json in context as
doc
if you execute the following has macros:
has(doc.fizz.buzz.baz)
true
has(doc.fizz.baz)
false
has(doc.fizz.baz.buzz)
has(document.fizz.baz.buzz)
, no such key: bazExpected behavior
Expect
has
macro to return false instead of an error.