{
    "id": "https://raw.githubusercontent.com/rolfvreijdenberger/jsend-json-schema/master/rest-fail-response-json-schema.json",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "A simple REST response schema for a payload for a non-succesful response.This schema allows you to add structured information that can be consumed by an API consumer in a standard way. HTTP status codes should indicate what went wrong.",
    "description": "",
    "type": "object",
    "required": [
        "messages"
    ],
    "properties": {
        "messages": {
            "description": "an array of message objects related to the failure",
            "type": "array",
            "minItems": 1,
            "items": {
                "description": "an object that contains fields related to a failure",
                "type": "object",
                "required": [
                    "message"
                ],
                "properties": {
                    "message": {
                        "description": "A meaningful, end-user-readable (or at the least log-worthy) message, explaining what happened.",
                        "type": "string"
                    },
                    "field": {
                        "description": "an optional string representation that maps to input. POST keys, a query parameter, a header key etc. For complex datastructures you could use different solutions like a dot seperated tree representation, an xpath expression etc.",
                        "type": "string"
                    },
                    "code": {
                        "description": "A numeric code providing info about a failure or error in a result, if applicable",
                        "type": [
                            "string",
                            "integer"
                        ]
                    }
                }
            }
        }
    }
}