Hi,
How to extract field name, tablename from mandatoryAttributesvalidator. I need to send friendly message as response to the model creation request. Want to avoid building custom validator to check mandatory data since out-of-box logic is already available, however I need to send the field name as separate field and message (missing value) as separate field in response.
Example, from the below exception thrown by hybris, I need to extract the field name ‘name’ from below message and send that in separate field as below:
de.hybris.platform.servicelayer.exceptions.ModelSavingException: [de.hybris.platform.servicelayer.interceptor.impl.MandatoryAttributesValidator@3eef167f]:missing values for [fieldName] in model TableNameModel () to create a new TableName
i need to send below as response:
"message": "missing value/mandatory field", "field": "fieldName" "code": "0001"
or
"message": "missing value/mandatory field", "field": "TableName.fieldName" "code": "0001"