User Story


  • We have a dynamic fields (params) on creating a user and customer, for that we are implementing a new method for validation error response handling
  • It will applicable for following API
  • The following code format are used to identify which type of error response API returning while validating the each json request object params.
    • Required: Q1001
    • Invalid: Q1002
    • Numeric: Q1003
    • Max: Q1004
    • Min: Q1005


    Notes:

    It will applicable for all json params not only addresses. Ex- equipments,phones,contacts..

  • The json object containing a array of object values, If any one object param is not satisfied the validation rules we will return a error code along with error message under the each object param.
    • (Ex- Refer sample format - Object One, Object Two,Object three - name,contact_person..... params)
  • If any object params is satisfied the validation rules we will return a null value for that params.
    • (Ex- Refer sample format - Object One, - email,phone_number and Object two - line_2,country,state.. params)
  • inside any objects all params are satisfied the validation rules we will return a null for that object.
    • (Ex- refer the sample format - Object four and five)

Sample Format



 "addresses": [

    Object One
            {
                "name": {
                    "code": "Q1004",
                    "message": "Addresses name exceeds 256 characters"
                },
                "email": null,
                "contact_person": {
                    "code": "Q1004",
                    "message": "Contact person name exceeds 512 characters"
                },
                "phone_number": null,
                "line_1": {
                    "code": "Q1004",
                    "message": "Line 1 exceeds 256 characters"
                },
                "line_2": {
                    "code": "Q1004",
                    "message": "Line 2 exceeds 256 characters"
                },
                "country": {
                    "code": "Q1002",
                    "message": "Selected country is invalid"
                },
                "state": {
                    "code": "Q1002",
                    "message": "Selected state is invalid"
                },
                "city": {
                    "code": "Q1004",
                    "message": "City exceeds 256 characters"
                },
                "zipcode": {
                    "code": "Q1005",
                    "message": "Zipcode should be minimum 3 characters"
                }
            },
     Object Two
            {
                "name": {
                    "code": "Q1004",
                    "message": "Addresses name exceeds 256 characters"
                },
                "email": {
                    "code": "Q1002",
                    "message": "Please provide valid email"
                },
                "contact_person": {
                    "code": "Q1004",
                    "message": "Contact person name exceeds 512 characters"
                },
                "phone_number": {
                    "code": "Q1005",
                    "message": "Zipcode should be minimum 6 characters"
                },
                "line_1": {
                    "code": "Q1004",
                    "message": "Line 1 exceeds 256 characters"
                },
                "line_2": null,
                "country": null,
                "state": null,
                "city": null,
                "zipcode": null
            },
    Object Three
            {
                "name": null,
                "email": {
                    "code": "Q1002",
                    "message": "Please provide valid email"
                },
                "contact_person": null,
                "phone_number": null,
                "line_1": null,
                "line_2": null,
                "country": {
                    "code": "Q1002",
                    "message": "Selected country is invalid"
                },
                "state": null,
                "city": null,
                "zipcode": {
                    "code": "Q1003",
                    "message": "Zipcode should be numeric"
                }
            },
    Object Four
    null,
    Object Five
    null
        ]
    }