{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://webgcp.org/schemas/bundle/v0.1.json",
  "$comment": "v0.1 stub schema. Full normative shape in prose at https://webgcp.org/spec/v0.1/#section-5-3. Validates top-level required fields only; field-level validation tightens in v0.2. Worked example: https://the-ai-news.web.app/webgcp/bundles/news-article-retrieval-v0.1.json.",
  "title": "webGCP Bundle Contract v0.1",
  "type": "object",
  "required": ["contract_uri", "contract_version", "fields"],
  "properties": {
    "contract_uri": {
      "type": "string",
      "pattern": "^urn:webgcp:",
      "description": "Globally unique bundle contract identifier."
    },
    "contract_version": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
    },
    "name": {"type": "string"},
    "purpose": {"type": "string"},
    "preferred_source_kb": {
      "type": "string",
      "pattern": "^urn:webgcp:"
    },
    "input_schema": {
      "type": "object",
      "description": "JSON Schema for the request filter."
    },
    "fields": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["name", "type", "required"],
        "properties": {
          "name": {"type": "string"},
          "type": {"type": "string"},
          "required": {"type": "boolean"},
          "primitive_hint": {
            "enum": [
              "direct_lookup",
              "hierarchical_tree",
              "vector_hybrid",
              "graph_traversal",
              "semantic_layer"
            ]
          },
          "authority_required": {
            "enum": ["canonical", "derived", "any"]
          },
          "on_failure": {
            "enum": ["hard_fail", "fallback", "annotate", "abstain"]
          },
          "freshness_sla": {"type": "string"},
          "acl_class": {"type": "string"},
          "pii_class": {
            "enum": ["none", "pseudonymous", "personal", "sensitive"]
          }
        }
      }
    },
    "type_definitions": {
      "type": "object",
      "description": "Inline type definitions referenced by fields[].items_type or fields[].type."
    }
  }
}
