--- title: Person description: JSON schema example for a person entity --- # Person

JSON schema example for a person entity

$idperson.yml
$schemahttp://json-schema.org/draft-07/schema#
## Properties
NameType
nameObject (of type Name)
dateOfBirthString
addressObject
friendsArray [Name]
## Example ``` { "name": { "title": "Mr", "firstName": "Seymour", "lastName": "Butts" }, "dateOfBirth": "1980-01-01", "address": { "houseNumber": 41, "street": "Some street", "city": "Swansea", "timeAtAddress": { "years": 1, "months": 3 } } } ``` ## Example ``` { "name": { "title": "Mr", "firstName": "Jane", "lastName": "Smith" }, "dateOfBirth": "1980-01-01", "address": { "houseNumber": 310, "street": "Any street", "city": "London" }, "friends": [ { "title": "Mr", "firstName": "Seymour", "lastName": "Butts" }, { "title": "Mrs", "firstName": "Marge", "lastName": "Simpson" } ] } ```
## name

Defined in ./name.html

$id name.yml
Title Name
Description JSON schema example for a name entity
TypeObject (of type Name)
Required Yes
### Properties
NameType
titleString
firstNameString
lastNameString
## dateOfBirth
Title Date of birth
Description The date at which a person was born.
TypeString
Required Yes
Format date
Examples
  • 1992-10-23
  • ## address
    Title Address
    Description The address at which a person lives.
    TypeObject
    Required Yes
    ### Properties
    NameType
    houseNumberString
    streetString
    cityString
    timeAtAddressObject
    ### address.houseNumber
    Title House Number
    Description The house number at which an address is located.
    TypeString
    Required Yes
    Min Length 1
    Max Length 10
    ### address.street
    Title Street
    Description The street in which an address is located.
    TypeString
    Required Yes
    Min Length 1
    Max Length 250
    ### address.city
    Title City
    Description The city in which an address is located.
    TypeString
    Required Yes
    Min Length 1
    Max Length 250
    ### address.timeAtAddress
    Title Time at address
    Description How long the person has lived at this address.
    TypeObject
    Required No
    ### address.timeAtAddress.years
    Title Years
    Description The number of years lived at this address.
    TypeNumber
    Required No
    Minimum 1
    Maximum 100
    ### address.timeAtAddress.months
    Title Months
    Description The number of months lived at this address.
    TypeInteger
    Required No
    Minimum 1
    Maximum 12
    ## friends

    Defined in ./name.html

    Title Friends
    Description An array containing the names of a person's friends.
    TypeArray [Name]
    Required No

    ## Schema ``` { "$id": "person.yml", "$schema": "http://json-schema.org/draft-07/schema#", "title": "Person", "description": "JSON schema example for a person entity", "type": "object", "examples": [ { "name": { "title": "Mr", "firstName": "Seymour", "lastName": "Butts" }, "dateOfBirth": "1980-01-01", "address": { "houseNumber": 41, "street": "Some street", "city": "Swansea", "timeAtAddress": { "years": 1, "months": 3 } } }, { "name": { "title": "Mr", "firstName": "Jane", "lastName": "Smith" }, "dateOfBirth": "1980-01-01", "address": { "houseNumber": 310, "street": "Any street", "city": "London" }, "friends": [ { "title": "Mr", "firstName": "Seymour", "lastName": "Butts" }, { "title": "Mrs", "firstName": "Marge", "lastName": "Simpson" } ] } ], "properties": { "name": { "$ref": "./name.yml" }, "dateOfBirth": { "title": "Date of birth", "description": "The date at which a person was born.", "type": "string", "format": "date", "examples": [ "1992-10-23" ] }, "address": { "title": "Address", "description": "The address at which a person lives.", "type": "object", "properties": { "houseNumber": { "title": "House Number", "description": "The house number at which an address is located.", "type": "string", "minLength": 1, "maxLength": 10 }, "street": { "title": "Street", "description": "The street in which an address is located.", "type": "string", "minLength": 1, "maxLength": 250 }, "city": { "title": "City", "description": "The city in which an address is located.", "type": "string", "minLength": 1, "maxLength": 250 }, "timeAtAddress": { "title": "Time at address", "description": "How long the person has lived at this address.", "type": "object", "properties": { "years": { "title": "Years", "description": "The number of years lived at this address.", "type": "number", "minimum": 1, "maximum": 100 }, "months": { "title": "Months", "description": "The number of months lived at this address.", "type": "integer", "minimum": 1, "maximum": 12 } } } }, "required": [ "houseNumber", "street", "city" ], "additionalProperties": false }, "friends": { "title": "Friends", "description": "An array containing the names of a person's friends.", "type": "array", "items": { "$ref": "./name.yml" } } }, "additionalProperties": false, "required": [ "name", "dateOfBirth", "address" ] } ```