How to specify that a JSON instance is defined by a specific JSON Schema

Viewed 879

My question is how can I know which JSON schema to use to validate a particular JSON document? I specified the URL to the schema in the id field from it. Is this enough? Should I put the id in the JSON? I am not sure I understand how to connect a JSON to a specific JSON Schema.

Here is my schema

{
 "$schema": "http://json-schema.org/draft-04/schema#",
 "id": "url/schema.json",
 "title": "title",
 "definitions": {
    "emailObject": {
        "type": "object",
        "properties":{
            "name": {
                "description": "The name of the customer",
                "type": "string",
                "maxLength": 200
            },
            "email": {
                "description": "The email of the customer",
                "type": "string",
                "format": "email",
                "maxLength": 100
            }
        }
    }
 }
2 Answers
Related