Lastly, we should include the $id keyword, which defines a unique URI for our schema. This URI can be used by other schemas to reference our schema, for example, when using our schema as a sub-schema. For now, just set it to a valid URL, preferably using a domain that you control:
"$id": "http://api.hobnob.social/schemas/users/profile.json"
If you don't know how to purchase a domain, we will show you in Chapter 10, Deploying Your Application on a VPS. For now, just use a dummy domain like example.com.
Our finished JSON Schema should look like this:
{
"$schema": "http://json-schema.org/schema#",
"$id": "http://api.hobnob.social/schemas/users/profile.json",
"title": "User Profile Schema",
"description": "For validating client-provided user profile object
when creating and/or updating an user",
"type": "object",
"properties": {
"bio": { "type": "string" },
"summary": { "type": "string" },
"name": {
"type": "object",
"properties": {
"first": { "type": "string" },
"last": { "type": "string" },
"middle": { "type": "string" }
},
"additionalProperties": false
}
},
"additionalProperties": false
}
Save this file to /src/schema/users/profile.json.