{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/platform-sh-routes/latest.json",
  "title": "Platform.sh routes configuration file",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/platformsh/platformify/refs/heads/main/validator/schema/platformsh.routes.json",
    "sourceSha256": "34dd05b6214ff3d69fa83a04047e3b2f0996d9d017afb1e8f92fa5de02935d00",
    "fileMatch": [
      "**/.platform/routes.yml",
      "**/.platform/routes.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "additionalProperties": {
    "oneOf": [
      {
        "type": "object",
        "properties": {
          "primary": {
            "type": "boolean",
            "title": "This route is the primary route of the environment",
            "default": null
          },
          "id": {
            "type": "string",
            "title": "Route Identifier",
            "default": null
          },
          "attributes": {
            "type": "object",
            "default": {},
            "title": "Arbitrary attributes attached to this resource",
            "additionalProperties": {
              "type": "string"
            }
          },
          "type": {
            "type": "string",
            "title": "Route type."
          },
          "redirects": {
            "type": "object",
            "properties": {
              "expires": {
                "type": [
                  "integer",
                  "string"
                ],
                "title": "The amount of time, in seconds, to cache the redirects.",
                "default": -1
              },
              "paths": {
                "type": "object",
                "title": "The paths to redirect",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "regexp": {
                      "type": "boolean",
                      "title": "Whether the path is a regular expression.",
                      "default": false
                    },
                    "to": {
                      "type": "string",
                      "title": "The URL to redirect to."
                    },
                    "prefix": {
                      "type": "boolean",
                      "title": "Whether to redirect all the paths that start with the path.",
                      "default": null
                    },
                    "append_suffix": {
                      "type": "boolean",
                      "title": "Whether to append the incoming suffix to the redirected URL.",
                      "default": null
                    },
                    "code": {
                      "type": "integer",
                      "title": "The redirect code to use.",
                      "default": 302
                    },
                    "expires": {
                      "type": [
                        "integer",
                        "string"
                      ],
                      "title": "The amount of time, in seconds, to cache the redirects.",
                      "default": null
                    }
                  },
                  "required": [
                    "to"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "paths"
            ],
            "default": {},
            "title": "The configuration of the redirects.",
            "additionalProperties": false
          },
          "tls": {
            "type": "object",
            "properties": {
              "strict_transport_security": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean",
                    "title": "Whether strict transport security is enabled or not.",
                    "default": null
                  },
                  "include_subdomains": {
                    "type": "boolean",
                    "title": "Whether the strict transport security policy should include all subdomains.",
                    "default": null
                  },
                  "preload": {
                    "type": "boolean",
                    "title": "Whether the strict transport security policy should be preloaded in browsers.",
                    "default": null
                  }
                },
                "default": {
                  "preload": null,
                  "include_subdomains": null,
                  "enabled": null
                },
                "title": "Strict-Transport-Security options.",
                "additionalProperties": false
              },
              "min_version": {
                "type": "string",
                "enum": [
                  "TLSv1.1",
                  "TLSv1.0",
                  "TLSv1.3",
                  "TLSv1.2"
                ],
                "title": "The minimum TLS version to support.",
                "default": null
              },
              "client_authentication": {
                "type": "string",
                "title": "The type of client authentication to request.",
                "default": null
              },
              "client_certificate_authorities": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "title": "Certificate authorities to validate the client certificate against. If not specified, a default set of trusted CAs will be used.",
                "default": []
              }
            },
            "default": {
              "client_authentication": null,
              "min_version": null,
              "client_certificate_authorities": [],
              "strict_transport_security": {
                "preload": null,
                "include_subdomains": null,
                "enabled": null
              }
            },
            "title": "TLS settings for the route.",
            "additionalProperties": false
          },
          "to": {
            "type": "string",
            "title": "Redirect destination"
          }
        },
        "required": [
          "type",
          "to"
        ],
        "additionalProperties": false
      },
      {
        "type": "object",
        "properties": {
          "primary": {
            "type": "boolean",
            "title": "This route is the primary route of the environment",
            "default": null
          },
          "id": {
            "type": "string",
            "title": "Route Identifier",
            "default": null
          },
          "attributes": {
            "type": "object",
            "default": {},
            "title": "Arbitrary attributes attached to this resource",
            "additionalProperties": {
              "type": "string"
            }
          },
          "type": {
            "type": "string",
            "title": "Route type."
          },
          "redirects": {
            "type": "object",
            "properties": {
              "expires": {
                "type": [
                  "integer",
                  "string"
                ],
                "title": "The amount of time, in seconds, to cache the redirects.",
                "default": -1
              },
              "paths": {
                "type": "object",
                "title": "The paths to redirect",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "regexp": {
                      "type": "boolean",
                      "title": "Whether the path is a regular expression.",
                      "default": false
                    },
                    "to": {
                      "type": "string",
                      "title": "The URL to redirect to."
                    },
                    "prefix": {
                      "type": "boolean",
                      "title": "Whether to redirect all the paths that start with the path.",
                      "default": null
                    },
                    "append_suffix": {
                      "type": "boolean",
                      "title": "Whether to append the incoming suffix to the redirected URL.",
                      "default": null
                    },
                    "code": {
                      "type": "integer",
                      "title": "The redirect code to use.",
                      "default": 302
                    },
                    "expires": {
                      "type": [
                        "integer",
                        "string"
                      ],
                      "title": "The amount of time, in seconds, to cache the redirects.",
                      "default": null
                    }
                  },
                  "required": [
                    "to"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "paths"
            ],
            "default": {},
            "title": "The configuration of the redirects.",
            "additionalProperties": false
          },
          "tls": {
            "type": "object",
            "properties": {
              "strict_transport_security": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean",
                    "title": "Whether strict transport security is enabled or not.",
                    "default": null
                  },
                  "include_subdomains": {
                    "type": "boolean",
                    "title": "Whether the strict transport security policy should include all subdomains.",
                    "default": null
                  },
                  "preload": {
                    "type": "boolean",
                    "title": "Whether the strict transport security policy should be preloaded in browsers.",
                    "default": null
                  }
                },
                "default": {
                  "preload": null,
                  "include_subdomains": null,
                  "enabled": null
                },
                "title": "Strict-Transport-Security options.",
                "additionalProperties": false
              },
              "min_version": {
                "type": "string",
                "enum": [
                  "TLSv1.1",
                  "TLSv1.0",
                  "TLSv1.3",
                  "TLSv1.2"
                ],
                "title": "The minimum TLS version to support.",
                "default": null
              },
              "client_authentication": {
                "type": "string",
                "title": "The type of client authentication to request.",
                "default": null
              },
              "client_certificate_authorities": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "title": "Certificate authorities to validate the client certificate against. If not specified, a default set of trusted CAs will be used.",
                "default": []
              }
            },
            "default": {
              "client_authentication": null,
              "min_version": null,
              "client_certificate_authorities": [],
              "strict_transport_security": {
                "preload": null,
                "include_subdomains": null,
                "enabled": null
              }
            },
            "title": "TLS settings for the route.",
            "additionalProperties": false
          },
          "cache": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean",
                "title": "Whether the cache is enabled."
              },
              "default_ttl": {
                "type": "integer",
                "title": "The TTL to apply when the response doesn't specify one. Only applies to static files.",
                "default": 0
              },
              "cookies": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "title": "The cookies to take into account for the cache key.",
                "default": [
                  "*"
                ]
              },
              "headers": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "title": "The headers to take into account for the cache key.",
                "default": [
                  "Accept",
                  "Accept-Language"
                ]
              }
            },
            "required": [
              "enabled"
            ],
            "default": {
              "default_ttl": 0,
              "cookies": [
                "*"
              ],
              "enabled": true,
              "headers": [
                "Accept",
                "Accept-Language"
              ]
            },
            "title": "Cache configuration.",
            "additionalProperties": false
          },
          "ssi": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean",
                "title": "Whether SSI include is enabled."
              }
            },
            "required": [
              "enabled"
            ],
            "default": {
              "enabled": false
            },
            "title": "Server-Side Include configuration.",
            "additionalProperties": false
          },
          "upstream": {
            "type": "string",
            "title": "The upstream to use for this route."
          }
        },
        "required": [
          "type",
          "upstream"
        ],
        "additionalProperties": false
      }
    ]
  }
}
