{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://optinrouter.ai/docs/schemas/grammar.schema.json",
  "title": "OptinRouter grammar preview contract",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "version": {
      "const": "2026-10-19-preview"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "format": {
      "const": "json_schema"
    },
    "target": {
      "enum": [
        "request",
        "tool_arguments",
        "response"
      ]
    },
    "definition": {
      "type": "object"
    },
    "max_bytes": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1048576
    },
    "max_depth": {
      "type": "integer",
      "minimum": 1,
      "maximum": 32
    },
    "on_invalid": {
      "enum": [
        "block",
        "hold"
      ]
    }
  },
  "required": [
    "version",
    "name",
    "format",
    "target",
    "definition",
    "max_bytes",
    "max_depth",
    "on_invalid"
  ]
}
