# JSON Schema validation fails: format 'uri-reference' rejects valid relative URIs

- **ID:** `data/json-schema-format-uri-reference`
- **Domain:** data
- **Category:** schema_error
- **Error Code:** `ValidationError`
- **Verification:** ai_generated
- **Fix Rate:** 90%

## 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.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| JSON Schema Draft 7+ | active | — | — |
| ajv 8.12.0+ | active | — | — |
| jsonschema 4.18.0+ (Python) | active | — | — |
| json-schema-validator 4.0.0+ (Java) | active | — | — |

## Workarounds

1. **Use a custom format validator that accepts relative URIs: `ajv.addFormat('uri-reference', { validate: (s) => /^[\w\/:.?&=#-]+$/.test(s) })`** (95% success)
   ```
   Use a custom format validator that accepts relative URIs: `ajv.addFormat('uri-reference', { validate: (s) => /^[\w\/:.?&=#-]+$/.test(s) })`
   ```
2. **Pre-process data to convert relative URIs to absolute by prepending a base URL before validation.** (85% success)
   ```
   Pre-process data to convert relative URIs to absolute by prepending a base URL before validation.
   ```
3. **Switch to a validator that uses a more lenient uri-reference implementation, like `@cfworker/json-schema`.** (80% success)
   ```
   Switch to a validator that uses a more lenient uri-reference implementation, like `@cfworker/json-schema`.
   ```

## Dead Ends

- **** — 'uri' format is stricter and requires absolute URIs with scheme, rejecting relative paths. (80% fail)
- **** — Weakens schema constraints and may allow invalid data to pass validation. (50% fail)
