All Downloads are FREE. Search and download functionalities are using the official Maven repository.

readobject.person-address-schema.json Maven / Gradle / Ivy

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"]
              }
            }
          }
        }
      ]
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy