vlbaluk / java-validator-livr

Lightweight java validator supporting Language Independent Validation Rules Specification (LIVR)
13 stars 10 forks source link

Add original field value to json error response #8

Closed rnaufal closed 4 years ago

rnaufal commented 4 years ago

This PR adds an additional node containing the error code and the original field value when some validation error occurs.

The attributes are named code for the error code and fieldValue for the original field value.

Below are some examples:

LIVR rules

{
    "order_id": ["required", "positive_integer"]
}

Data for validation

{
    "order_id": -10345,
}

old error return

{
    "order_id": "NOT_POSITIVE_INTEGER"
}

new error return

{
    "order_id": {
        "code":"NOT_POSITIVE_INTEGER",
        "value": -10345
    }
}
vlbaluk commented 4 years ago

@rnaufal Did application pass all tests successfully? Could you please also update build jar files.

rnaufal commented 4 years ago

@rnaufal Did application pass all tests successfully? Could you please also update build jar files.

Yes, all tests are passing successfully. I have updated the build jar files as well. What about adding an integration with GitHub actions to run all the unit tests on each pull request to validate it?