Document JSON Structure ID URI
document-json-structure-id-uri
info
experience: consistencyexperience: discoverability
spec: document
$id should be an absolute URI.
$id should be a stable absolute URI (https:// or urn:) identifying the schema.
Rule definition
The full Spotlight rule — drop it into a ruleset (.spotlight.yaml / .spectral.yaml) and run it with any Spotlight tool.
document-json-structure-id-uri:
title: Document JSON Structure ID URI
reference: https://spotlight-rules.com/spec/rules/json-structure/document-json-structure-id-uri/
description: $id should be a stable absolute URI (https:// or urn:) identifying
the schema.
message: $id should be an absolute URI.
given: $.$id
severity: info
then:
function: pattern
functionOptions:
match: "^https?://|^urn:"
tags:
- format:json-structure
- spec:document
- experience:consistency
- experience:discoverability
prompt: "You are editing a JSON Structure document to satisfy the Spotlight API
governance rule 'document-json-structure-id-uri' (Document JSON Structure ID
URI). Requirement: $id should be a stable absolute URI (https:// or urn:)
identifying the schema. To fix: Ensure the targeted value matches the
regular expression `^https?://|^urn:`; rewrite any value that does not. This
rule is evaluated at the JSONPath `$.$id` — inspect every location it
matches and correct only what violates the rule. Make the smallest change
that satisfies the rule, leave all unrelated content, key order, comments,
and formatting unchanged, and keep the document valid JSON Structure. Return
only the complete corrected document, with no commentary."
AI fix prompt — send this to Claude, Gemini, or ChatGPT with your artifact to auto-fix this rule
You are editing a JSON Structure document to satisfy the Spotlight API governance rule 'document-json-structure-id-uri' (Document JSON Structure ID URI). Requirement: $id should be a stable absolute URI (https:// or urn:) identifying the schema. To fix: Ensure the targeted value matches the regular expression `^https?://|^urn:`; rewrite any value that does not. This rule is evaluated at the JSONPath `$.$id` — inspect every location it matches and correct only what violates the rule. Make the smallest change that satisfies the rule, leave all unrelated content, key order, comments, and formatting unchanged, and keep the document valid JSON Structure. Return only the complete corrected document, with no commentary.
| Artifact | JSON Structure |
|---|---|
| Applies at (given) | $.$id |
| Severity | info — educational by default; raise to warn/error to enforce |
| Reference | https://spotlight-rules.com/spec/rules/json-structure/document-json-structure-id-uri/ |