{
  "id": "data/json-schema-format-uri-reference",
  "signature": "JSON Schema validation fails: format 'uri-reference' rejects valid relative URIs",
  "signature_zh": "JSON Schema 验证失败：format 'uri-reference' 拒绝有效的相对 URI",
  "regex": "ValidationError.*format.*uri-reference|does not match.*uri-reference|format.*uri-reference.*rejected",
  "domain": "data",
  "category": "schema_error",
  "subcategory": null,
  "root_cause": "JSON Schema validators use different implementations of the 'uri-reference' format; some apply strict RFC 3986 parsing that rejects relative URIs without a scheme.",
  "root_cause_type": "generic",
  "root_cause_zh": "JSON Schema 验证器使用不同的 'uri-reference' 格式实现；一些应用严格的 RFC 3986 解析，拒绝没有 scheme 的相对 URI。",
  "versions": [
    {
      "version": "JSON Schema Draft 7+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "ajv 8.12.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "jsonschema 4.18.0+ (Python)",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "json-schema-validator 4.0.0+ (Java)",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "'uri' format is stricter and requires absolute URIs with scheme, rejecting relative paths.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Weakens schema constraints and may allow invalid data to pass validation.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use a custom format validator that accepts relative URIs: `ajv.addFormat('uri-reference', { validate: (s) => /^[\\w\\/:.?&=#-]+$/.test(s) })`",
      "success_rate": 0.95,
      "how": "Use a custom format validator that accepts relative URIs: `ajv.addFormat('uri-reference', { validate: (s) => /^[\\w\\/:.?&=#-]+$/.test(s) })`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Pre-process data to convert relative URIs to absolute by prepending a base URL before validation.",
      "success_rate": 0.85,
      "how": "Pre-process data to convert relative URIs to absolute by prepending a base URL before validation.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Switch to a validator that uses a more lenient uri-reference implementation, like `@cfworker/json-schema`.",
      "success_rate": 0.8,
      "how": "Switch to a validator that uses a more lenient uri-reference implementation, like `@cfworker/json-schema`.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "使用自定义格式验证器接受相对 URI：`ajv.addFormat('uri-reference', { validate: (s) => /^[\\w\\/:.?&=#-]+$/.test(s) })`",
    "在验证前预处理数据，通过添加基础 URL 将相对 URI 转换为绝对 URI。",
    "切换到使用更宽松的 uri-reference 实现的验证器，如 `@cfworker/json-schema`。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://json-schema.org/understanding-json-schema/reference/string.html#format",
  "official_doc_section": null,
  "error_code": "ValidationError",
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-09-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}