Schema: profile

{
  "$defs": {
    "callableContract": {
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "name": {
                "const": "tojson_html_text"
              }
            }
          },
          "then": {
            "properties": {
              "sink": {
                "const": "json_html_text"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "name": {
                "const": "tojson_quoted_attribute"
              }
            }
          },
          "then": {
            "properties": {
              "sink": {
                "const": "json_quoted_attribute"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "name": {
                "const": "tojson_script_data"
              }
            }
          },
          "then": {
            "properties": {
              "sink": {
                "const": "json_script_data"
              }
            }
          }
        },
        {
          "else": {
            "properties": {
              "fixture_ids": {
                "additionalProperties": false,
                "properties": {
                  "rejection": {
                    "$ref": "#/$defs/fixtureIdList"
                  }
                },
                "required": [
                  "rejection"
                ],
                "type": "object"
              },
              "output_type": {
                "const": "Never"
              },
              "selected_call_sites": {
                "maxItems": 0
              }
            }
          },
          "if": {
            "properties": {
              "applicability": {
                "const": "admitted"
              }
            }
          },
          "then": {
            "properties": {
              "fixture_ids": {
                "additionalProperties": false,
                "properties": {
                  "adversarial": {
                    "$ref": "#/$defs/fixtureIdList"
                  },
                  "boundary": {
                    "$ref": "#/$defs/fixtureIdList"
                  },
                  "positive": {
                    "$ref": "#/$defs/fixtureIdList"
                  }
                },
                "required": [
                  "positive",
                  "boundary",
                  "adversarial"
                ],
                "type": "object"
              },
              "selected_call_sites": {
                "minItems": 1
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "applicability": {
                "const": "admitted"
              },
              "sink": {
                "const": "json_html_text"
              }
            }
          },
          "then": {
            "properties": {
              "output_type": {
                "const": "JsonForHtmlText"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "applicability": {
                "const": "admitted"
              },
              "sink": {
                "const": "json_quoted_attribute"
              }
            }
          },
          "then": {
            "properties": {
              "output_type": {
                "const": "JsonForQuotedAttribute"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "applicability": {
                "const": "admitted"
              },
              "sink": {
                "const": "json_script_data"
              }
            }
          },
          "then": {
            "properties": {
              "output_type": {
                "const": "JsonForScriptData"
              }
            }
          }
        }
      ],
      "properties": {
        "applicability": {
          "enum": [
            "admitted",
            "unselected_rejected"
          ],
          "type": "string"
        },
        "fixture_ids": {
          "type": "object"
        },
        "input_type": {
          "const": "json_serializable"
        },
        "limits": {
          "additionalProperties": false,
          "properties": {
            "input_max_bytes": {
              "minimum": 1,
              "type": "integer"
            },
            "output_max_bytes": {
              "minimum": 1,
              "type": "integer"
            }
          },
          "required": [
            "input_max_bytes",
            "output_max_bytes"
          ],
          "type": "object"
        },
        "name": {
          "enum": [
            "tojson_html_text",
            "tojson_quoted_attribute",
            "tojson_script_data"
          ],
          "type": "string"
        },
        "output_type": {
          "enum": [
            "JsonForHtmlText",
            "JsonForQuotedAttribute",
            "JsonForScriptData",
            "Never"
          ],
          "type": "string"
        },
        "rejection_mode": {
          "const": "typed_failure"
        },
        "selected_call_sites": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "line": {
                "minimum": 1,
                "type": "integer"
              },
              "path": {
                "pattern": "^assets/templates/.+\\.html$",
                "type": "string"
              }
            },
            "required": [
              "path",
              "line"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "sink": {
          "enum": [
            "json_html_text",
            "json_quoted_attribute",
            "json_script_data"
          ],
          "type": "string"
        }
      },
      "required": [
        "name",
        "sink",
        "applicability",
        "input_type",
        "output_type",
        "limits",
        "rejection_mode",
        "selected_call_sites",
        "fixture_ids"
      ],
      "type": "object"
    },
    "environmentWhitespacePolicy": {
      "additionalProperties": false,
      "properties": {
        "keep_trailing_newline": {
          "type": "boolean"
        },
        "lstrip_blocks": {
          "type": "boolean"
        },
        "newline_sequence": {
          "enum": [
            "\n",
            "\r\n"
          ],
          "type": "string"
        },
        "trim_blocks": {
          "type": "boolean"
        }
      },
      "required": [
        "trim_blocks",
        "lstrip_blocks",
        "newline_sequence",
        "keep_trailing_newline"
      ],
      "type": "object"
    },
    "fixtureIdList": {
      "items": {
        "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$",
        "type": "string"
      },
      "minItems": 1,
      "type": "array",
      "uniqueItems": true
    },
    "htmxEvidence": {
      "additionalProperties": false,
      "properties": {
        "evidence_file": {
          "minLength": 1,
          "type": "string"
        },
        "evidence_sha256": {
          "pattern": "^[a-f0-9]{64}$",
          "type": "string"
        },
        "max_exclusive": {
          "$ref": "#/$defs/version"
        },
        "min": {
          "$ref": "#/$defs/version"
        }
      },
      "required": [
        "min",
        "max_exclusive",
        "evidence_file",
        "evidence_sha256"
      ],
      "type": "object"
    },
    "safeRendering": {
      "additionalProperties": false,
      "allOf": [
        {
          "not": {
            "properties": {
              "allowed_attributes_by_element": {
                "properties": {
                  "a": {
                    "contains": {
                      "const": "rel"
                    }
                  }
                },
                "required": [
                  "a"
                ]
              }
            }
          }
        }
      ],
      "properties": {
        "allowed_attributes_by_element": {
          "additionalProperties": {
            "items": {
              "pattern": "^[a-z][a-z0-9-]*$",
              "type": "string"
            },
            "type": "array",
            "uniqueItems": true
          },
          "minProperties": 1,
          "propertyNames": {
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "type": "object"
        },
        "allowed_elements": {
          "items": {
            "pattern": "^[a-z][a-z0-9-]*$",
            "type": "string"
          },
          "minItems": 1,
          "type": "array",
          "uniqueItems": true
        },
        "allowed_url_schemes": {
          "items": {
            "enum": [
              "http",
              "https",
              "mailto",
              "tel"
            ],
            "type": "string"
          },
          "minItems": 1,
          "type": "array",
          "uniqueItems": true
        },
        "callable_contracts": {
          "allOf": [
            {
              "contains": {
                "properties": {
                  "name": {
                    "const": "tojson_html_text"
                  }
                },
                "required": [
                  "name"
                ]
              },
              "maxContains": 1,
              "minContains": 1
            },
            {
              "contains": {
                "properties": {
                  "name": {
                    "const": "tojson_quoted_attribute"
                  }
                },
                "required": [
                  "name"
                ]
              },
              "maxContains": 1,
              "minContains": 1
            },
            {
              "contains": {
                "properties": {
                  "name": {
                    "const": "tojson_script_data"
                  }
                },
                "required": [
                  "name"
                ]
              },
              "maxContains": 1,
              "minContains": 1
            }
          ],
          "items": {
            "$ref": "#/$defs/callableContract"
          },
          "minItems": 1,
          "type": "array"
        },
        "capabilities": {
          "additionalProperties": false,
          "properties": {
            "css_allowed": {
              "type": "boolean"
            },
            "custom_elements_allowed": {
              "type": "boolean"
            },
            "embed_allowed": {
              "type": "boolean"
            },
            "form_allowed": {
              "type": "boolean"
            },
            "iframe_allowed": {
              "type": "boolean"
            },
            "media_elements_allowed": {
              "type": "boolean"
            },
            "object_allowed": {
              "type": "boolean"
            }
          },
          "required": [
            "css_allowed",
            "form_allowed",
            "iframe_allowed",
            "object_allowed",
            "embed_allowed",
            "custom_elements_allowed",
            "media_elements_allowed"
          ],
          "type": "object"
        },
        "fixture_suite_revision": {
          "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$",
          "type": "string"
        },
        "policy": {
          "additionalProperties": false,
          "properties": {
            "external_digest": {
              "$ref": "#/$defs/sha256"
            },
            "id": {
              "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$",
              "type": "string"
            },
            "schema_version": {
              "$ref": "#/$defs/version"
            },
            "semantic_version": {
              "$ref": "#/$defs/version"
            }
          },
          "required": [
            "schema_version",
            "id",
            "semantic_version",
            "external_digest"
          ],
          "type": "object"
        },
        "rejection_mode": {
          "enum": [
            "typed_failure",
            "escaped_text"
          ],
          "type": "string"
        },
        "relative_url_behavior": {
          "enum": [
            "allow",
            "deny"
          ],
          "type": "string"
        },
        "required_link_rel": {
          "items": {
            "enum": [
              "noopener",
              "noreferrer"
            ],
            "type": "string"
          },
          "minItems": 1,
          "type": "array",
          "uniqueItems": true
        },
        "resource_limits": {
          "additionalProperties": false,
          "properties": {
            "attribute_value_max_bytes": {
              "minimum": 1,
              "type": "integer"
            },
            "max_attribute_count": {
              "minimum": 1,
              "type": "integer"
            },
            "max_url_length": {
              "minimum": 1,
              "type": "integer"
            },
            "output_max_bytes": {
              "minimum": 1,
              "type": "integer"
            },
            "sanitizer_input_max_bytes": {
              "minimum": 1,
              "type": "integer"
            },
            "transition_input_max_bytes": {
              "additionalProperties": false,
              "properties": {
                "safe_attrs": {
                  "minimum": 1,
                  "type": "integer"
                },
                "sanitized_content": {
                  "minimum": 1,
                  "type": "integer"
                },
                "tojson": {
                  "minimum": 1,
                  "type": "integer"
                }
              },
              "required": [
                "sanitized_content",
                "safe_attrs",
                "tojson"
              ],
              "type": "object"
            }
          },
          "required": [
            "sanitizer_input_max_bytes",
            "output_max_bytes",
            "max_attribute_count",
            "attribute_value_max_bytes",
            "max_url_length",
            "transition_input_max_bytes"
          ],
          "type": "object"
        },
        "sanitizer": {
          "additionalProperties": false,
          "properties": {
            "kind": {
              "enum": [
                "ammonia"
              ],
              "type": "string"
            },
            "version": {
              "$ref": "#/$defs/version"
            }
          },
          "required": [
            "kind",
            "version"
          ],
          "type": "object"
        },
        "strip_comments": {
          "type": "boolean"
        },
        "transition_rejection_modes": {
          "additionalProperties": false,
          "properties": {
            "safe_attrs": {
              "enum": [
                "typed_failure",
                "escaped_text"
              ],
              "type": "string"
            },
            "sanitized_content": {
              "enum": [
                "typed_failure",
                "escaped_text"
              ],
              "type": "string"
            },
            "tojson": {
              "enum": [
                "typed_failure",
                "escaped_text"
              ],
              "type": "string"
            }
          },
          "required": [
            "sanitized_content",
            "safe_attrs",
            "tojson"
          ],
          "type": "object"
        }
      },
      "required": [
        "policy",
        "sanitizer",
        "allowed_elements",
        "allowed_attributes_by_element",
        "allowed_url_schemes",
        "relative_url_behavior",
        "strip_comments",
        "capabilities",
        "required_link_rel",
        "resource_limits",
        "rejection_mode",
        "transition_rejection_modes",
        "fixture_suite_revision",
        "callable_contracts"
      ],
      "type": "object"
    },
    "sha256": {
      "pattern": "^[a-f0-9]{64}$",
      "type": "string"
    },
    "staticPublication": {
      "additionalProperties": false,
      "properties": {
        "default_cache_control": {
          "minLength": 1,
          "type": "string"
        },
        "exposed_roots": {
          "items": {
            "minLength": 1,
            "type": "string"
          },
          "type": "array"
        },
        "require_provenance_marker": {
          "type": "boolean"
        },
        "required_paths": {
          "items": {
            "minLength": 1,
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "required_paths",
        "exposed_roots"
      ],
      "type": "object"
    },
    "version": {
      "pattern": "^\\d+\\.\\d+\\.\\d+$",
      "type": "string"
    },
    "versionList": {
      "items": {
        "$ref": "#/$defs/version"
      },
      "minItems": 1,
      "type": "array"
    }
  },
  "$id": "https://australis.systems/schemas/htmx-ui-template-scaffold/profile.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Strict schema for the normalized compatibility profile envelope (Shape B, nested htmx_range evidence structure). Single canonical shape; no oneOf / anyOf branches.",
  "properties": {
    "autoescape": {
      "type": "boolean"
    },
    "component_corpus_versions": {
      "additionalProperties": {
        "additionalProperties": false,
        "properties": {
          "max_exclusive": {
            "$ref": "#/$defs/version"
          },
          "min": {
            "$ref": "#/$defs/version"
          }
        },
        "required": [
          "min",
          "max_exclusive"
        ],
        "type": "object"
      },
      "type": "object"
    },
    "csp_requirements": {
      "additionalProperties": {
        "anyOf": [
          {
            "type": "boolean"
          },
          {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        ]
      },
      "type": "object"
    },
    "destination_runtime": {
      "minLength": 1,
      "type": "string"
    },
    "environment": {
      "$ref": "#/$defs/environmentWhitespacePolicy"
    },
    "htmx_range": {
      "$ref": "#/$defs/htmxEvidence"
    },
    "id": {
      "minLength": 1,
      "type": "string"
    },
    "macros_version": {
      "$ref": "#/$defs/version"
    },
    "profile_version": {
      "$ref": "#/$defs/version"
    },
    "safe_rendering": {
      "$ref": "#/$defs/safeRendering"
    },
    "schema_version": {
      "const": "1.0.0",
      "type": "string"
    },
    "source_runtime": {
      "minLength": 1,
      "type": "string"
    },
    "static_publication": {
      "$ref": "#/$defs/staticPublication"
    },
    "strict_undefined": {
      "type": "boolean"
    },
    "template_dialect": {
      "minLength": 1,
      "type": "string"
    }
  },
  "required": [
    "schema_version",
    "id",
    "profile_version",
    "source_runtime",
    "destination_runtime",
    "template_dialect",
    "htmx_range",
    "macros_version",
    "strict_undefined",
    "autoescape",
    "environment",
    "csp_requirements",
    "static_publication",
    "component_corpus_versions",
    "safe_rendering"
  ],
  "title": "Compatibility Profile",
  "type": "object"
}