Relative Content

Tag Archive for javajsonspring-bootjsonschemajson-schema-validator

How to use $ref to set conditions on objects of sub schemas using json schema draft 2020-21 in a spring boot project?

I’m trying to do json schema validation in spring boot 3.3.3, in resources folder I have put the schemas main.json, sub1.json and sub2.json. I’m using $ref to refer other schema objects from main schema and I want to set a field condition in sub2 based on a value of property from sub1, but I’m getting required field missing always when validating even when value is different. Added expected and obtained result at the end with same results.

“prefixItems” of Json Schema 2020-12 version validating only first element of the array

I am using the following json schema to validate json. When I have more than one elements in the array of “appData” in the json, it validates only the first “appData” in the “appData” array, i.e. the json schema validates only appData[0]. The rest like appData[1], appData[2] are not validated. Is it that “prefixItems” validates only the first element of the array?