{
    "additionalProperties": false,
    "description": "Schema for API Request Enrichment configuration",
    "properties": {
        "enabled": {
            "type": "boolean"
        },
        "name": {
            "type": "string"
        },
        "parameters": {
            "additionalProperties": false,
            "properties": {
                "api": {
                    "additionalProperties": false,
                    "maxProperties": 1,
                    "minProperties": 1,
                    "properties": {
                        "http": {
                            "additionalProperties": false,
                            "properties": {
                                "authentication": {
                                    "additionalProperties": false,
                                    "properties": {
                                        "httpBasic": {
                                            "additionalProperties": false,
                                            "properties": {
                                                "password": {
                                                    "type": "string"
                                                },
                                                "username": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "username",
                                                "password"
                                            ],
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                },
                                "method": {
                                    "enum": [
                                        "GET",
                                        "POST",
                                        "PUT"
                                    ],
                                    "type": "string"
                                },
                                "timeout": {
                                    "maximum": 60000,
                                    "minimum": 1,
                                    "type": "integer"
                                },
                                "uri": {
                                    "type": "string"
                                }
                            },
                            "required": [
                                "method",
                                "uri",
                                "timeout",
                                "authentication"
                            ],
                            "type": "object"
                        }
                    },
                    "type": "object"
                },
                "cache": {
                    "additionalProperties": false,
                    "properties": {
                        "size": {
                            "minimum": 0,
                            "type": "integer"
                        },
                        "ttl": {
                            "maximum": 86400,
                            "minimum": 0,
                            "type": "integer"
                        }
                    },
                    "required": [
                        "size",
                        "ttl"
                    ],
                    "type": "object"
                },
                "inputs": {
                    "items": {
                        "additionalProperties": false,
                        "maxProperties": 2,
                        "minProperties": 2,
                        "properties": {
                            "json": {
                                "additionalProperties": false,
                                "properties": {
                                    "field": {
                                        "enum": [
                                            "unstruct_event",
                                            "contexts",
                                            "derived_contexts"
                                        ],
                                        "type": "string"
                                    },
                                    "jsonPath": {
                                        "pattern": "^\\$.*$",
                                        "type": "string"
                                    },
                                    "schemaCriterion": {
                                        "pattern": "^iglu:[a-zA-Z0-9-_.]+/[a-zA-Z0-9-_]+/[a-zA-Z0-9-_]+/([1-9][0-9]*|\\*)-((?:0|[1-9][0-9]*)|\\*)-((?:0|[1-9][0-9]*)|\\*)$",
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            },
                            "key": {
                                "pattern": "^[A-Za-z0-9_-]+$",
                                "type": "string"
                            },
                            "pojo": {
                                "additionalProperties": false,
                                "properties": {
                                    "field": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "required": [
                            "key"
                        ],
                        "type": "object"
                    },
                    "type": "array"
                },
                "outputs": {
                    "items": {
                        "additionalProperties": false,
                        "maxProperties": 2,
                        "minProperties": 2,
                        "properties": {
                            "json": {
                                "additionalProperties": false,
                                "properties": {
                                    "jsonPath": {
                                        "pattern": "^\\$.*$",
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "jsonPath"
                                ],
                                "type": "object"
                            },
                            "schema": {
                                "pattern": "^iglu:([a-zA-Z0-9-_.]+)/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([1-9][0-9]*(?:-(?:0|[1-9][0-9]*)){2})$",
                                "type": "string"
                            }
                        },
                        "required": [
                            "schema"
                        ],
                        "type": "object"
                    },
                    "minItems": 1,
                    "type": "array"
                }
            },
            "required": [
                "inputs",
                "api",
                "outputs",
                "cache"
            ],
            "type": "object"
        },
        "vendor": {
            "type": "string"
        }
    },
    "required": [
        "name",
        "vendor",
        "enabled",
        "parameters"
    ],
    "self": {
        "format": "jsonschema",
        "name": "api_request_enrichment_config",
        "vendor": "com.snowplowanalytics.snowplow.enrichments",
        "version": "1-0-1"
    },
    "type": "object"
}