After fixing #374 fcli now properly throws an error if a user tries to filter on non-existing properties.
This will also apply in cases where the field is available only on some objects (for example if the API does not deliver a null field rather than delivering a field with null value).
To work around the errors in these cases the user can use the has() method to verify the existence of the property.
Example:
For top level properties
... list -q "(has('property2') && property2=='value2')"
For nested properties:
... list -q "nestedObject!=null && get('nestedObject').has('stringValue') && nestedObject.stringValue=='nestedObjectValue1'"
For nested array properties:
... list -q "nestedObjectArray !=null && !(nestedObjectArray.isEmpty()) && get('nestedObjectArray').get(0).has('stringValue') && nestedObjectArray.get(0).stringValue=='nestedArrayValue1' "
The get method returns the item as JsonNode, which is necessary in some cases where you want to execute the has method on a child property
After fixing #374 fcli now properly throws an error if a user tries to filter on non-existing properties. This will also apply in cases where the field is available only on some objects (for example if the API does not deliver a null field rather than delivering a field with null value). To work around the errors in these cases the user can use the
has()
method to verify the existence of the property.Example:
For top level properties
... list -q "(has('property2') && property2=='value2')"
For nested properties:
... list -q "nestedObject!=null && get('nestedObject').has('stringValue') && nestedObject.stringValue=='nestedObjectValue1'"
For nested array properties:
... list -q "nestedObjectArray !=null && !(nestedObjectArray.isEmpty()) && get('nestedObjectArray').get(0).has('stringValue') && nestedObjectArray.get(0).stringValue=='nestedArrayValue1' "
The
get
method returns the item as JsonNode, which is necessary in some cases where you want to execute thehas
method on a child property