Closed harryarora26 closed 3 months ago
@harryarora26, in your example, the individual phone number should be referenced using the value
attribute. The JSON for a phone number in the form you've described would look something like:
{
"phoneNumbers": [
{
"value": "123",
"type": "work"
}
]
}
So the path should be phoneNumbers[value eq "123"]
, not [phoneNumbers eq "123"]
. To create a path of this form, you would pass "value"
for the attribute
parameter:
Path.root().attribute("phoneNumbers", Filter.eq("value", "123"));
Is your feature request related to a problem? Please describe. The currently available function, Path.attribute(String attribute, Filter valueFilter) only provides a way to refer to the values of sub-attribute of the attribute represented by the current path instance. What if the user wants to refer to the value of a top-level attribute. For example, when the top-level attribute is a multi-value attribute(not complex multi-value) there is no way to reference its value.
Describe the solution you'd like A function can be added to provide this functionality. For example, Path.attribute(Filter valueFilter)
Describe alternatives you've considered For example, in the schema if "phoneNumbers" is a top-level attribute which is defined as multi-value of type String, the filter to point to its value equal "123" is path = "[ phoneNumbers eq \"123\"]". The only possible way to have this Path being generated by the Path class is by setting the attribute variable to an empty String in the function: Path.attribute(String attribute, Filter valueFilter)