fortify / fcli

fcli is a command-line utility for interacting with various Fortify products
https://fortify.github.io/fcli/
Other
29 stars 16 forks source link

DOC: describe how to check for and use inconsistent properties in expressions #386

Closed psmf22 closed 11 months ago

psmf22 commented 11 months ago

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