{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "$id": "https://www.krakend.io/schema/v2.13/backend_extra_config.json",
  "title": "Extra configuration for backends",
  "type": "object",
  "properties": {
    "ai/llm": {
      "$ref": "ai/llm.json"
    },
    "auth/aws-sigv4": {
      "$ref": "auth/aws-sigv4.json"
    },
    "auth/client-credentials": {
      "$ref": "auth/client-credentials.json"
    },
    "auth/gcp": {
      "$ref": "auth/gcp.json"
    },
    "auth/ntlm": {
      "$ref": "auth/ntlm.json"
    },
    "backend/amqp/consumer": {
      "$ref": "backend/amqp/consumer.json"
    },
    "backend/amqp/producer": {
      "$ref": "backend/amqp/producer.json"
    },
    "backend/conditional": {
      "$ref": "backend/conditional.json"
    },
    "backend/graphql": {
      "$ref": "backend/graphql.json"
    },
    "backend/grpc": {
      "$ref": "backend/grpc.json"
    },
    "backend/http": {
      "oneOf": [
        {
          "required": [ "return_error_details" ]
        },
        {
          "required": [ "return_error_code" ]
        }
      ],
      "properties": {
        "return_error_code": {
          "title": "Return error code",
          "description": "Returns the HTTP status code of the backend (when there is only one). The headers are not returned.\n\nSee: https://www.krakend.io/docs/backends/detailed-errors/",
          "type": "boolean"
        },
        "return_error_details": {
          "title": "Return error details",
          "description": "Returns to the client details of a failing request.\n\nSee: https://www.krakend.io/docs/backends/detailed-errors/",
          "type": "string"
        }
      }
    },
    "backend/http/client": {
      "$ref": "backend/http_client.json"
    },
    "backend/lambda": {
      "$ref": "backend/lambda.json"
    },
    "backend/pubsub/publisher": {
      "$ref": "backend/pubsub/publisher.json"
    },
    "backend/pubsub/subscriber": {
      "$ref": "backend/pubsub/subscriber.json"
    },
    "backend/pubsub/publisher/kafka": {
      "$ref": "backend/pubsub/kafka/publisher.json"
    },
    "backend/pubsub/subscriber/kafka": {
      "$ref": "backend/pubsub/kafka/subscriber.json"
    },
    "backend/soap": {
      "$ref": "backend/soap.json"
    },
    "backend/static-filesystem": {
      "$ref": "backend/static-filesystem.json"
    },
    "governance/quota": {
      "$ref": "governance/quota.json"
    },
    "modifier/body-generator": {
      "$ref": "modifier/body-generator.json"
    },
    "modifier/jmespath": {
      "$ref": "modifier/jmespath.json"
    },
    "modifier/lua-backend": {
      "$ref": "modifier/lua.json"
    },
    "modifier/martian": {
      "title": "Martian modifiers",
      "description": "Transform requests and responses through a simple DSL definition in the configuration file.\n\nSee: https://www.krakend.io/docs/backends/martian/",
      "$ref": "modifier/martian.json",
      "type": "object"
    },
    "modifier/request-body-generator": {
      "$ref": "modifier/body-generator.json"
    },
    "modifier/response-body": {
      "$ref": "modifier/response-body.json"
    },
    "modifier/response-body-generator": {
      "$ref": "modifier/body-generator.json"
    },
    "plugin/http-client": {
      "$ref": "plugin/http-client.json"
    },
    "plugin/middleware": {
      "$ref": "plugin/middleware.json"
    },
    "plugin/req-resp-modifier": {
      "$ref": "plugin/req-resp-modifier.json"
    },
    "proxy": {
      "$ref": "proxy.json"
    },
    "qos/circuit-breaker": {
      "$ref": "qos/circuit-breaker.json"
    },
    "qos/circuit-breaker/http": {
      "$ref": "qos/circuit-breaker-http.json"
    },
    "qos/http-cache": {
      "title": "Backend Cache",
      "description": "Enable in-memory caching for backend responses for as long as its `Cache-Control` header permits. Only safe methods are cached (GET or HEAD). The final backend URL and the `Vary` headers are used to create the caching key.\n\nSee: https://www.krakend.io/docs/backends/caching/",
      "type": "object",
      "oneOf": [
        {
          "required": [ "max_size", "max_items" ]
        },
        {
          "required": [ "shared" ]
        },
        {
          "maxProperties": 0
        }
      ],
      "properties": {
        "max_items": {
          "title": "Max items",
          "description": "To be released on open source on v2.10. The maximum number of items the LRU cache will store **for this cache bucket** before starting to do evictions. When `max_items` is declared, you must declare `max_size` as well.\n\nSee: https://www.krakend.io/docs/backends/caching/",
          "examples": [],
          "type": "integer",
          "minimum": 1
        },
        "max_size": {
          "title": "Max size",
          "description": "To be released on open source on v2.10. The maximum number of bytes you allow the LRU cache to store **for this cache bucket** before starting to do evictions. This is not the total cache you allow to the system, but the number of bytes you reserve to this backend (or its `shared` neighbours). will store before starting to do evictions. When `max_size` is declared, you must declare `max_items` as well.\n\nSee: https://www.krakend.io/docs/backends/caching/",
          "examples": [ 104857600, 1048576 ],
          "type": "integer",
          "minimum": 1024
        },
        "shared": {
          "title": "Shared cache",
          "description": "Allows different backend definitions with this flag set to true to reuse the store between them when the request is the same. Otherwise, each backend uses a private cache context that is not accessible by other endpoints. The cache definition is unique for every backend URL + `Vary` header combination.\n\nSee: https://www.krakend.io/docs/backends/caching/",
          "type": "boolean"
        }
      },
      "patternProperties": {
        "^[@$_#]": true
      },
      "additionalProperties": false
    },
    "qos/ratelimit/proxy": {
      "$ref": "qos/ratelimit/proxy.json"
    },
    "security/policies": {
      "title": "Securiy Policies",
      "description": "Enterprise only. The policies engine allows you to write custom sets of policies that are validated during requests, responses, or token validation.\n\nSee: https://www.krakend.io/docs/enterprise/security-policies/",
      "type": "object",
      "anyOf": [
        {
          "required": [ "req" ]
        },
        {
          "required": [ "resp" ]
        }
      ],
      "properties": {
        "auto_join_policies": {
          "title": "Auto-join policies",
          "description": "When true, all policies of the same type concatenate with an AND operation to evaluate a single expression. Performs faster, but its harder the debug.",
          "default": false,
          "type": "boolean"
        },
        "debug": {
          "title": "Debug",
          "description": "When true, all the inputs and evaluation results are printed in the console.",
          "default": false,
          "type": "boolean"
        },
        "disable_macros": {
          "title": "Disable advanced macros",
          "description": "Advanced macros can be disabled in those policies not needing them for a faster evaluation.",
          "default": false,
          "type": "boolean"
        },
        "req": {
          "title": "Request policies",
          "description": "All the policies applied in the request context.\n\nSee: https://www.krakend.io/docs/enterprise/security-policies/",
          "type": "object",
          "required": [ "policies" ],
          "properties": {
            "error": {
              "type": "object",
              "properties": {
                "body": {
                  "title": "Error body",
                  "description": "Leave an empty string to use the validation error, or write a string with the error response body. This error is NOT returned in the response, but in the application logs, unless you enable `return_detailed_errors` in the `router` section. You can add escaped JSON, XML, etc in the string and add a Content-Type.\n\nSee: https://www.krakend.io/docs/enterprise/security-policies/",
                  "default": "",
                  "type": "string"
                },
                "content_type": {
                  "title": "Content-Type",
                  "description": "The Content-Type header you'd like to send with the error response. When unset, uses `text/plain` by default.\n\nSee: https://www.krakend.io/docs/enterprise/security-policies/",
                  "default": "text/plain",
                  "type": "string"
                },
                "status": {
                  "title": "HTTP status code",
                  "description": "The HTTP status code you want to return when the validation fails.\n\nSee: https://www.krakend.io/docs/enterprise/security-policies/",
                  "default": 500,
                  "type": "integer"
                }
              }
            },
            "policies": {
              "title": "Policies",
              "description": "An array with all the policies to evaluate. Each policy is represented as a string\n\nSee: https://www.krakend.io/docs/enterprise/security-policies/",
              "type": "array",
              "minItems": 1,
              "items": {
                "title": "The policy you want to evaluate",
                "type": "string"
              }
            }
          },
          "patternProperties": {
            "^[@$_#]": true
          },
          "additionalProperties": false
        },
        "resp": {
          "title": "Response policies",
          "description": "All the policies applied in the response context.\n\nSee: https://www.krakend.io/docs/enterprise/security-policies/",
          "type": "object",
          "required": [ "policies" ],
          "properties": {
            "error": {
              "type": "object",
              "properties": {
                "body": {
                  "title": "Error body",
                  "description": "Leave an empty string to use the validation error, or write a string with the error response body. This error is NOT returned in the response, but in the application logs, unless you enable `return_detailed_errors` in the `router` section. You can add escaped JSON, XML, etc in the string and add a Content-Type.\n\nSee: https://www.krakend.io/docs/enterprise/security-policies/",
                  "default": "",
                  "type": "string"
                },
                "content_type": {
                  "title": "Content-Type",
                  "description": "The Content-Type header you'd like to send with the error response. When unset, uses `text/plain` by default.\n\nSee: https://www.krakend.io/docs/enterprise/security-policies/",
                  "default": "text/plain",
                  "type": "string"
                },
                "status": {
                  "title": "HTTP status code",
                  "description": "The HTTP status code you want to return when the validation fails.\n\nSee: https://www.krakend.io/docs/enterprise/security-policies/",
                  "default": 500,
                  "type": "integer"
                }
              }
            },
            "policies": {
              "title": "Policies",
              "description": "An array with all the policies to evaluate. Each policy is represented as a string\n\nSee: https://www.krakend.io/docs/enterprise/security-policies/",
              "type": "array",
              "minItems": 1,
              "items": {
                "title": "The policy you want to evaluate",
                "type": "string"
              }
            }
          },
          "patternProperties": {
            "^[@$_#]": true
          },
          "additionalProperties": false
        }
      },
      "patternProperties": {
        "^[@$_#]": true
      },
      "additionalProperties": false
    },
    "telemetry/logging": {
      "title": "Backend Log",
      "description": "Enterprise only. Add a specific Backend Log. Useful to see status codes, headers, and other information that come from your backends.\n\nSee: https://www.krakend.io/docs/enterprise/logging/",
      "type": "object",
      "properties": {
        "backend": {
          "$ref": "telemetry/backend_log.json"
        }
      },
      "patternProperties": {
        "^[@$_#]": true
      },
      "additionalProperties": false
    },
    "telemetry/opentelemetry": {
      "$ref": "telemetry/opentelemetry-backend.json"
    },
    "validation/cel": {
      "$ref": "validation/cel.json"
    },
    "validation/response-json-schema": {
      "$ref": "validation/response-json-schema.json"
    },
    "workflow": {
      "title": "Workflow",
      "description": "Enterprise only. A whole new endpoint that is executed within this backend context.",
      "$ref": "workflow.json",
      "type": "object"
    }
  },
  "patternProperties": {
    "^[@$_#]": true
  },
  "additionalProperties": false
}
