{
    "additionalProperties": false,
    "description": "Schema for a bad row resulting from adapter failures",
    "properties": {
        "failure": {
            "additionalProperties": false,
            "description": "Information regarding the adapter violations",
            "properties": {
                "messages": {
                    "description": "List of failure messages associated with the adapter failures",
                    "items": {
                        "anyOf": [
                            {
                                "additionalProperties": false,
                                "description": "Error which was internal to the adapter regarding its input data",
                                "properties": {
                                    "expectation": {
                                        "description": "Expectation which was not met",
                                        "maxLength": 256,
                                        "type": "string"
                                    },
                                    "field": {
                                        "description": "Field which did not meet the adapter's expectations",
                                        "maxLength": 64,
                                        "type": "string"
                                    },
                                    "value": {
                                        "description": "Stringified representation of the value which did not meet expectations",
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "field",
                                    "value",
                                    "expectation"
                                ],
                                "type": "object"
                            },
                            {
                                "additionalProperties": false,
                                "description": "String supplied for schema validation was not json",
                                "properties": {
                                    "error": {
                                        "description": "Json parsing issue",
                                        "type": "string"
                                    },
                                    "field": {
                                        "description": "Field which ended up not being json",
                                        "maxLength": 64,
                                        "type": "string"
                                    },
                                    "value": {
                                        "description": "Stringified representation of the value which is not json",
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "field",
                                    "value",
                                    "error"
                                ],
                                "type": "object"
                            },
                            {
                                "additionalProperties": false,
                                "description": "Json supplied for schema validation was not self-describing",
                                "properties": {
                                    "error": {
                                        "description": "Issue which the json which makes it not self-describing",
                                        "enum": [
                                            "INVALID_SCHEMAVER",
                                            "INVALID_IGLUURI",
                                            "INVALID_DATA_PAYLOAD",
                                            "INVALID_SCHEMA"
                                        ],
                                        "type": "string"
                                    },
                                    "json": {
                                        "description": "Supplied json which was not self-describing (can be any JSON value)"
                                    }
                                },
                                "required": [
                                    "json",
                                    "error"
                                ],
                                "type": "object"
                            },
                            {
                                "additionalProperties": false,
                                "description": "Could not map the adapter vendor event type to an Iglu schema",
                                "properties": {
                                    "actual": {
                                        "description": "The actual event type as determined by the adapter's logic",
                                        "maxLength": 256,
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "expectation": {
                                        "description": "Expectation regarding the mapping which was not met",
                                        "maxLength": 256,
                                        "type": "string"
                                    },
                                    "expectedMapping": {
                                        "additionalProperties": {
                                            "type": "string"
                                        },
                                        "description": "The possible mappings between adapter vendor event types and Iglu schemas",
                                        "type": "object"
                                    }
                                },
                                "required": [
                                    "actual",
                                    "expectedMapping",
                                    "expectation"
                                ],
                                "type": "object"
                            }
                        ]
                    },
                    "type": "array"
                },
                "timestamp": {
                    "_format": "date-time",
                    "description": "Timestamp at which the failure occurred",
                    "type": "string"
                },
                "vendor": {
                    "description": "Vendor of the adapter that processed this payload",
                    "maxLength": 64,
                    "type": "string"
                },
                "version": {
                    "description": "Version of the adapter that processed this payload",
                    "maxLength": 16,
                    "type": "string"
                }
            },
            "required": [
                "timestamp",
                "vendor",
                "version",
                "messages"
            ],
            "type": "object"
        },
        "payload": {
            "additionalProperties": false,
            "description": "The collector payload that resulted in adapter failures",
            "properties": {
                "body": {
                    "description": "Body of this collector payload",
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "collector": {
                    "description": "Collector which produced this collector payload",
                    "maxLength": 32,
                    "type": "string"
                },
                "contentType": {
                    "description": "Content type of the payload as detected by the collector",
                    "maxLength": 256,
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "encoding": {
                    "description": "Encoding of the collector payload",
                    "maxLength": 32,
                    "type": "string"
                },
                "headers": {
                    "description": "List of the headers part of this collector payload",
                    "items": {
                        "maxLength": 8192,
                        "type": "string"
                    },
                    "type": [
                        "array",
                        "null"
                    ]
                },
                "hostname": {
                    "description": "Hostname of the payload as detected by the collector",
                    "maxLength": 8192,
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "ipAddress": {
                    "description": "IP address of the payload as detected by the collector",
                    "maxLength": 128,
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "networkUserId": {
                    "_format": "uuid",
                    "description": "Network user id associated with this payload",
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "querystring": {
                    "description": "Query string of this collector payload",
                    "items": {
                        "additionalProperties": false,
                        "properties": {
                            "name": {
                                "description": "Name of the querystring parameter",
                                "maxLength": 512,
                                "type": "string"
                            },
                            "value": {
                                "description": "Possible value for the querystring parameter",
                                "maxLength": 512,
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        },
                        "required": [
                            "name",
                            "value"
                        ],
                        "type": "object"
                    },
                    "type": [
                        "array",
                        "null"
                    ]
                },
                "refererUri": {
                    "description": "Referer of the payload as detected by the collector",
                    "maxLength": 8192,
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "timestamp": {
                    "_format": "date-time",
                    "description": "Timestamp at which the payload was collected",
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "useragent": {
                    "description": "User agent of the payload as detected by the collector",
                    "maxLength": 4096,
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "vendor": {
                    "description": "Vendor of the adapter that processed this payload",
                    "maxLength": 64,
                    "type": "string"
                },
                "version": {
                    "description": "Version of the adapter that processed this payload",
                    "maxLength": 16,
                    "type": "string"
                }
            },
            "required": [
                "vendor",
                "version",
                "collector",
                "encoding"
            ],
            "type": "object"
        },
        "processor": {
            "additionalProperties": false,
            "description": "Information about the piece of software responsible for the creation of adapter failures",
            "properties": {
                "artifact": {
                    "description": "Artifact responsible for the creation of adapter failures",
                    "maxLength": 512,
                    "type": "string"
                },
                "version": {
                    "description": "Version of the artifact responsible for the creation of adapter failures",
                    "maxLength": 32,
                    "pattern": "^(\\d+\\.\\d+\\.\\d+.*)$",
                    "type": "string"
                }
            },
            "required": [
                "artifact",
                "version"
            ],
            "type": "object"
        }
    },
    "required": [
        "failure",
        "payload",
        "processor"
    ],
    "self": {
        "format": "jsonschema",
        "name": "adapter_failures",
        "vendor": "com.snowplowanalytics.snowplow.badrows",
        "version": "1-0-0"
    },
    "type": "object"
}