Schema JSON LD Context URI Or Object
schema-json-ld-context-uri-or-object
info
experience: data-modelingexperience: consistency
spec: document
@context should be a URI, object, or array.
@context should be a URI string, an inline object, or an array of those.
Rule definition
The full Spotlight rule — drop it into a ruleset (.spotlight.yaml / .spectral.yaml) and run it with any Spotlight tool.
schema-json-ld-context-uri-or-object:
title: Schema JSON LD Context URI Or Object
reference: https://spotlight-rules.com/spec/rules/json-ld/schema-json-ld-context-uri-or-object/
description: "@context should be a URI string, an inline object, or an array of those."
message: "@context should be a URI, object, or array."
given: $['@context']
severity: info
then:
function: schema
functionOptions:
schema:
type:
- string
- object
- array
tags:
- format:json-ld
- spec:document
- experience:data-modeling
- experience:consistency
prompt: "You are editing a JSON-LD document to satisfy the Spotlight API
governance rule 'schema-json-ld-context-uri-or-object' (Schema JSON LD
Context URI Or Object). Requirement: @context should be a URI string, an
inline object, or an array of those. To fix: Adjust the targeted value so it
conforms to the schema this rule requires. This rule is evaluated at the
JSONPath `$.@context` — 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-LD. 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-LD document to satisfy the Spotlight API governance rule 'schema-json-ld-context-uri-or-object' (Schema JSON LD Context URI Or Object). Requirement: @context should be a URI string, an inline object, or an array of those. To fix: Adjust the targeted value so it conforms to the schema this rule requires. This rule is evaluated at the JSONPath `$.@context` — 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-LD. Return only the complete corrected document, with no commentary.
| Artifact | JSON-LD |
|---|---|
| Applies at (given) | $['@context'] |
| Severity | info — educational by default; raise to warn/error to enforce |
| Reference | https://spotlight-rules.com/spec/rules/json-ld/schema-json-ld-context-uri-or-object/ |