readobject.person-address-schema.json Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of medeia-validator-kotlin-examples Show documentation
Show all versions of medeia-validator-kotlin-examples Show documentation
Medeia streaming JSON-schema validator for the JVM platform,
Kotlin Examples.
The newest version!
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/Person",
"definitions": {
"Person": {
"type": "object",
"properties": {
"firstName": {
"type": "string",
"minLength": 1
},
"lastName": {
"type": "string",
"minLength": 1
},
"address": {
"$ref": "#/definitions/Address"
}
},
"required": [
"lastName",
"address"
]
},
"Address": {
"properties": {
"street1": {
"type": "string"
},
"street2": {
"type": "string"
},
"postalCode": {
"type": "string"
},
"city": {
"type": "string",
"minLength": 1
},
"region": {
"type": "string"
},
"country": {
"type": "string"
}
},
"required": [
"street1",
"postalCode",
"city"
],
"allOf": [
{
"if": {
"properties": {
"country": {
"const": "Australia"
}
}
},
"then": {
"required": ["region"],
"properties": {
"postalCode": {
"minLength": 4,
"maxLength": 4,
"pattern": "^\\d{4}$"
},
"region": {
"description": "State",
"enum": ["NSW", "ACT", "VIC", "QLD", "SA", "WA", "TAS", "NT"]
}
}
}
}
]
}
}
}