Validator Object
  • 1 Minute to read
  • PDF

Validator Object

  • PDF

Article summary

Validator Object

 

 

In order for data to import into WithoutWire correctly, it must meet some basic requirements. Some fields cannot be empty and some fields require a string value less than a certain amount of characters. The Validator was created to provide users with an appropriate error message when the import data provided does not meet WithoutWire’s requirements.

 

 

 

IsValid

 

Description: A boolean variable indicating whether or not the object is valid.

Data Type: Boolean

Value: true, false

Required: Yes

Note: Default to true.

 

 

 

ImportException

 

Description: An ImportException is used to define an error message and a field name.

Note: One object may have many errors. Default to an empty collection.

Below, we’ve mocked up a sample JSON Validator object. A user who passed in an inventory record with a Warehouse name and Bin Number that were too long, would receive the below object in response.

 

 

 

Sample JSON Object

 

[

 {

  "IsValid: false

   "ImportExceptions":

    [

      {

         "ErrorMessage": "Warehouse Name cannot be longer than 10 characters.",

         "FieldName": "WarehouseName"

      },

      {

         "ErrorMessage": "Bin Number cannot be longer than 10 characters.",

         "FieldName": "BinNumber"

      }

    ]

 }

]