JSON Schema Keywords
57 keywords from the JSON Schema Draft 2020-12 specification, covering applicator, assertion, annotation, identifier, and content vocabularies. Each entry records the keyword name, the JSON instance types it applies to, and a precise description of its semantics and validation behavior.
Quick fetch
Stable URL. CORS-enabled. No auth.
curl https://staticdata.dev/v1/json-schema-keywords.json
Or use as a typed import:
import { jsonSchemaKeywords } from "https://staticdata.dev/v1/json-schema-keywords.ts"
Formats
- JSON 15.6 KB
/v1/json-schema-keywords.json
min: 13.5 KB · /v1/json-schema-keywords.min.json
- CSV 11.1 KB
/v1/json-schema-keywords.csv
- TypeScript 15.8 KB
/v1/json-schema-keywords.ts
export const jsonSchemaKeywords
type JsonSchemaKeyword = (typeof jsonSchemaKeywords)[number]
Schema
Each record in the dataset has the following shape.
| Field | Type | Description | Example |
|---|---|---|---|
| keyword | string | The JSON Schema keyword name including $ prefix where applicable | $ref |
| appliesTo | string[] | JSON instance types the keyword applies to; 'any' means all types | ["string"] |
| description | string | Precise description of the keyword semantics and validation behavior | Validates that the string matches the given regular expression. |
Preview
First 10 records.
| keyword | description |
|---|---|
| $anchor | Defines a plain-name fragment anchor within a schema resource. The value must be a valid anchor string. References can target it with a URI fragment like '#anchorName'. |
| $comment | Provides a place for schema authors to include comments. The value must be a string. Validators must not attach any meaning to it; it is purely for human readers. |
| $defs | Defines a set of reusable sub-schemas. The value is an object whose property values are schemas. Sub-schemas defined here do not constrain the instance by themselves; they must be referenced via $ref or similar. |
| $dynamicAnchor | Works like $anchor but marks the location as a dynamic anchor that can be overridden by $dynamicRef when composing schemas. Allows extension points in reusable schema libraries. |
| $dynamicRef | Like $ref, but resolves dynamically by walking the dynamic scope to find the outermost matching $dynamicAnchor. Enables open recursion and extension of recursive schemas. |
| $id | Sets the base URI and identifies the schema resource. Must be an absolute URI or a URI-reference that resolves to an absolute URI. Changes how relative $ref URIs within the schema are resolved. |
| $ref | References another schema by URI. The value must be a string URI. The referenced schema is applied to the instance in place of the $ref keyword. In Draft 2020-12, sibling keywords are allowed alongside $ref. |
| $schema | Declares which dialect of JSON Schema the schema is written in. Must be an absolute URI. Validators use it to determine which keywords and semantics apply. Should be used in the document root schema and may appear in the roots of embedded schema resources, but must not appear elsewhere. |
| $vocabulary | Declares which vocabularies a dialect meta-schema uses and whether each is required or optional. Values are objects mapping vocabulary URIs to booleans. Only meaningful in meta-schemas. |
| additionalProperties | Applies to all properties not matched by 'properties' or 'patternProperties'. The value is a schema. If false, any additional property causes validation failure; otherwise each additional property must validate against the given schema. |
Fetch examples
Drop-in snippets in five languages.
curl -sSL https://staticdata.dev/v1/json-schema-keywords.json | jq '.[0]' import type { JsonSchemaKeyword } from "https://staticdata.dev/v1/json-schema-keywords.ts";
const res = await fetch("https://staticdata.dev/v1/json-schema-keywords.min.json");
if (!res.ok) throw new Error(`Fetch failed: ${res.status}`);
const jsonSchemaKeywords: JsonSchemaKeyword[] = await res.json();
console.log(jsonSchemaKeywords[0]); import urllib.request, json
with urllib.request.urlopen("https://staticdata.dev/v1/json-schema-keywords.min.json") as r:
jsonSchemaKeywords = json.load(r)
print(jsonSchemaKeywords[0]) package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("https://staticdata.dev/v1/json-schema-keywords.min.json")
if err != nil { panic(err) }
defer resp.Body.Close()
var data []map[string]any
if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
panic(err)
}
fmt.Println(data[0])
} use serde_json::Value;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let body = ureq::get("https://staticdata.dev/v1/json-schema-keywords.min.json").call()?.into_string()?;
let data: Vec<Value> = serde_json::from_str(&body)?;
println!("{:?}", data.first());
Ok(())
} Sources and methodology
This dataset is curated from the JSON Schema Draft 2020-12 specification and its companion documents covering validation, meta-data annotations, format, and content vocabularies. All 57 keywords defined across the core and validation specifications are included, from structural applicators like $ref and $dynamicRef through assertion keywords like type, pattern, and minimum, to annotation-only keywords like title, description, and examples.
The appliesTo field lists the JSON instance types for which the keyword is relevant. The value "any" indicates the keyword applies regardless of instance type (common for applicators, boolean logic operators, and annotation keywords). Type-specific keywords list one or more of the seven JSON types: "null", "boolean", "integer", "number", "string", "array", and "object". Note that "integer" is a subset of "number" in JSON Schema semantics.
This dataset is useful for building JSON Schema linters, validators, documentation generators, IDE autocompletion tools, and educational resources. It covers the complete keyword set introduced in Draft 2020-12, including newer keywords such as prefixItems, unevaluatedItems, unevaluatedProperties, $dynamicRef, and $dynamicAnchor that differ from earlier drafts. Keywords removed or replaced in 2020-12 (additionalItems, the array form of items, dependencies, definitions, $recursiveRef and $recursiveAnchor) are not included. The 57 keywords match exactly the properties declared by the seven 2020-12 vocabulary meta-schemas (core, applicator, unevaluated, validation, meta-data, format-annotation and content).
Versioning
URLs under /v1/ are stable: field names and types will not change in a way
that breaks consumers. Values can be corrected or records added when the upstream source
changes; schema-incompatible updates ship under a new version path. See the
json-schema-keywords changelog for this dataset's history.
Related datasets
More Code datasets
- ansi-colors
- ascii
- cron-presets
- css-at-rules
- css-functions
- css-named-colors
- css-pseudo-classes
- css-pseudo-elements
- css-units
- data-units
- exit-codes
- file-signatures
- hash-algorithms
- js-array-methods
- js-math-methods
- js-object-methods
- js-string-methods
- jwt-claims
- mathematical-constants
- measurement-units
- node-builtin-modules
- owasp-top-10
- periodic-table
- physical-constants
- posix-signals
- programming-languages
- regex-flags
- regex-patterns
- roman-numerals
- si-base-units
- si-derived-units
- si-prefixes
- spdx-licenses
- strftime-tokens
- tailwind-colors
- time-units
- unicode-blocks
- unicode-general-categories
- unicode-planes
- unix-file-permissions
- xterm-256-colors