{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/swisstopo/json-schema/swisstopo-wms-request-schema.json",
  "title": "WmsRequest",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/swisstopo-openapi.yml#/components/schemas/WmsRequest",
  "required": [
    "webmapId",
    "layerId"
  ],
  "type": "object",
  "properties": {
    "webmapId": {
      "type": "string"
    },
    "layerId": {
      "type": "string"
    },
    "filters": {
      "type": "array",
      "description": "List of applied filters and their parameter values",
      "items": {
        "$ref": "#/$defs/WmsRequest_filters"
      }
    }
  },
  "$defs": {
    "ByAttributeFilterParameter": {
      "type": "object",
      "required": [
        "attribute",
        "value"
      ],
      "properties": {
        "attribute": {
          "type": "string",
          "description": "Attribute key available from /layers/{layerId}/attributeList"
        },
        "value": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            }
          ],
          "description": "Attribute value to match"
        }
      }
    },
    "ChronostratigraphyFilterParameter": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "Younger",
            "From-To",
            "Older"
          ]
        },
        "from": {
          "type": "string",
          "description": "From term (required if type is From-To or Older)"
        },
        "to": {
          "type": "string",
          "description": "To term (required if type is From-To or Younger)"
        }
      }
    },
    "TermFilterParameter": {
      "type": "object",
      "required": [
        "term"
      ],
      "properties": {
        "term": {
          "type": "string",
          "description": "Selected term from vocabulary"
        },
        "includeNarrowers": {
          "type": "boolean",
          "description": "Whether to include narrower terms",
          "default": true
        }
      }
    },
    "WmsRequest_filters": {
      "type": "object",
      "properties": {
        "filterId": {
          "type": "string",
          "enum": [
            "f-chronostrat-term",
            "f-tectonic-term",
            "f-lithostrat-term",
            "f-lithology-term",
            "f-byAttribute"
          ]
        },
        "parameters": {
          "oneOf": [
            {
              "$ref": "#/$defs/ChronostratigraphyFilterParameter"
            },
            {
              "$ref": "#/$defs/TermFilterParameter"
            },
            {
              "$ref": "#/$defs/ByAttributeFilterParameter"
            }
          ]
        }
      }
    }
  }
}