Schema: route-contract

{
  "$id": "https://htmx-ui-template-scaffold.local/schemas/route-contract.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Route-to-template mapping contract for one provider (currently rust-axum). Maps each HTTP method/path to the template file that renders the route, with an optional actions list for handlers that bind to non-default verbs.",
  "properties": {
    "document_status": {
      "const": "ACTIVE",
      "type": "string"
    },
    "provider": {
      "const": "rust-axum",
      "type": "string"
    },
    "routes": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "actions": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "confirm": {
                  "type": "string"
                },
                "endpoint": {
                  "pattern": "^/",
                  "type": "string"
                },
                "id": {
                  "pattern": "^[a-z][a-z0-9-]*$",
                  "type": "string"
                },
                "indicator": {
                  "type": "string"
                },
                "label": {
                  "minLength": 1,
                  "type": "string"
                },
                "method": {
                  "enum": [
                    "GET",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE"
                  ],
                  "type": "string"
                },
                "push_url": {
                  "type": "string"
                },
                "response_representation": {
                  "const": "HTML_PARTIAL"
                },
                "swap": {
                  "enum": [
                    "innerHTML",
                    "outerHTML",
                    "beforebegin",
                    "afterbegin",
                    "beforeend",
                    "afterend",
                    "none"
                  ],
                  "type": "string"
                },
                "target": {
                  "pattern": "^#[A-Za-z][A-Za-z0-9_-]*$",
                  "type": "string"
                },
                "trigger": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "label",
                "method",
                "endpoint",
                "target",
                "response_representation"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "method": {
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD",
              "OPTIONS"
            ],
            "type": "string"
          },
          "path": {
            "minLength": 1,
            "type": "string"
          },
          "template_path": {
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "method",
          "path",
          "template_path"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "schema_version": {
      "const": "1.0.0",
      "type": "string"
    }
  },
  "required": [
    "schema_version",
    "document_status",
    "provider",
    "routes"
  ],
  "title": "Route Contract",
  "type": "object"
}