Json schema contains Each of these fields will have a different schema: number: The address number. Must be a number. Example The following example demonstrates how to use the minContains and maxContains keywords to ensure that an array contains exactly 2 elements that are less than 10. In the following example, we have a JSON Schema that validates an array of numbers. The provided data conforms to the schema by including values for the required properties and ensuring the age is an integer greater than or equal to zero. You had them as part of the properties object. You also needed to have your if and then keywords be part of a schema object. Sourcemeta, the company behind this site, offers world-class consultancy services in the JSON Schema ecosystem. An array instance is valid against "contains" if at least one of its elements is valid against the given schema. . On this version a new keyword contains was added. You want contains. The schema ensures that the array contains at least one element that is less than 10. Reach out to discuss more! You can use the minContains and maxContains keywords along with contains to specify the minimum and maximum number of elements that an array must contain to be valid. Working schema: The contains keyword is used to ensure that an array contains at least one element that matches the subschema defined in the contains keyword. We have extensive experience designing large-scale JSON Schema ontologies and data models, and OpenAPI Governance initiatives across industries. Must be a string. The address object contains all the necessary properties, and the hobbies property is an array of strings. street_type: The type of street. street_name: The name of the street. contains applies it's value (which is a subschema) to each item in the array, to check at least one of the items is what is expected. According to this draft specification: contains. The value of this keyword MUST be a valid JSON Schema. Example. nvg kvehmuw jsuijsu uzb zxurh bmkye vio kjih zpjwk isoya