Class JsonValidationUtils
java.lang.Object
com.bonitasoft.processbuilder.extension.JsonValidationUtils
Utility class for generic JSON structure validation checks, decoupled from the main parsing logic.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidvalidateField(com.fasterxml.jackson.databind.JsonNode parentNode, String fieldName, Predicate<com.fasterxml.jackson.databind.JsonNode> typeCheck, String errorMessageField) A utility method to validate the existence and type of a specific field in a JSON node.static voidvalidateMemberships(com.fasterxml.jackson.databind.JsonNode memberShipsNode) Validates that the 'memberShips' node is a JSON array and that all elements within the array are non-empty strings (membership references).
-
Method Details
-
validateField
public static void validateField(com.fasterxml.jackson.databind.JsonNode parentNode, String fieldName, Predicate<com.fasterxml.jackson.databind.JsonNode> typeCheck, String errorMessageField) throws org.bonitasoft.engine.connector.ConnectorValidationException A utility method to validate the existence and type of a specific field in a JSON node.- Parameters:
parentNode- The parent JSON node to search in.fieldName- The name of the field to validate.typeCheck- A predicate to check the required type of the field (e.g., JsonNode::isTextual).errorMessageField- The name of the field to use in the error message.- Throws:
org.bonitasoft.engine.connector.ConnectorValidationException- if the field is missing or has an invalid type.
-
validateMemberships
public static void validateMemberships(com.fasterxml.jackson.databind.JsonNode memberShipsNode) throws org.bonitasoft.engine.connector.ConnectorValidationException Validates that the 'memberShips' node is a JSON array and that all elements within the array are non-empty strings (membership references).- Parameters:
memberShipsNode- The JSON node containing the list of membership references.- Throws:
org.bonitasoft.engine.connector.ConnectorValidationException- if the node is not an array or if any element is not a valid string reference.
-