
The ProcessingMessage object then is used in iterartor to iterate over the report generated by the line below

JsonNode schemajsonNode = omFile(schemaFile) In case you want to fetch the schema from an URL, then one small code change will be needed Instead of :-įile schemaFile = new File("/Users/RajarsheeMukhopadhya/Documents/Disk/schema.json") There is also a possibility of loading the json schema from an URL instead of disk, but I will stick to loading from local for this use case. What this code does is basically loads the json schema and the json payload from my local drive and casts them in JSONNode object then we use the JSONSchemaFactory and ProcessingReport classes to validate the payload against the schema. To achieve this I did reverse engineer some java code on stack overflow to find a solution.īelow is a snapshot of the code that I had used Recently I did come across this situation and decided to make a reusable component which can take in the required JSON schema and the json payload and validate it against the schema. In those cases business rules becomes tedious and requires a new logic to be written for each interfaces. To do so we normally write validation rules using the Business rules shape, provided by Dell Boomi, which serves our purpose, however the problem arises if we were to validate a bulk of fields and also if there are multiple interfaces which needs these validations. The normal approach for validating a json structure against a json schema would be to manually identify the fields that are required, check maybe the date time format, field types like integer, character. 4.This article will illustrate how to validate a json payload against a json schema of either a source or a target application. If we call fLocal again, we'll just create a new variable. So now we can see that even though we have created one q variable, that variable isn't available anymore in other scopes. Since we create q with the def keyword, we won't be able to access it via the global scope.Įvidently, we can access q using the fLocal function: logger = Logger.getLogger("oovy")


The reason why it's failing is that q is a local variable, which belongs to the scope of function fLocal. ("- Local variable doesn't exist outside") So, let's try and define a global variable y and a function-local variable: logger = Logger.getLogger("oovy") This way, we define this variable to be part of the scope where the thread is running. Specifically, we'll be looking at keyword def.
