api: YAML JSON TOON Database
version: 1.0.0
format: json
dataset:
  id: 1005
  slug: json-schema-keywords
  title: JSON Schema 2020-12 Keyword Reference
  description: Core validation and composition keywords in JSON Schema 2020-12, with compact examples and traps.
  summary: Core validation and composition keywords in JSON Schema 2020-12, with compact examples and traps. Each row includes a practical application and a failure to check before using it.
  use_when:
    - Validate a dataset before sending it to an agent.
    - Design a small contract for API input or a downloaded table.
  caveats:
    - These examples target draft 2020-12.
    - Validation does not establish factual correctness.
  related:
    - date-time-interchange
    - http-response-headers
  category: Web Technologies
  category_slug: web-technologies
  tags: web-technologies,json schema keywords,reference,engineering
  view_count: 0
  created_at: 1791798640
  updated_at: 1791798640
  reviewed_at: "2026-10-12"
  sources:
    - title: JSON Schema validation specification
      url: "https://json-schema.org/draft/2020-12/json-schema-validation"
    - title: JSON Schema reference
      url: "https://json-schema.org/understanding-json-schema/reference"
  reading:
    - validate-reference-data-with-json-schema
  provenance: Original editorial reference notes by YJTOON, informed by the linked primary documentation. External specifications retain their own licenses.
  entry_count: 16
  fields:
    - section: data
      field: keyword
      type: string
      example: type
    - section: data
      field: example
      type: string
      example: "{\"type\":\"string\"}"
    - section: data
      field: purpose
      type: string
      example: Constrain the JSON value type.
    - section: data
      field: pitfall
      type: string
      example: A numeric-looking string is still a string.
data:
  - keyword: type
    example: "{\"type\":\"string\"}"
    purpose: Constrain the JSON value type.
    pitfall: A numeric-looking string is still a string.
  - keyword: properties
    example: "{\"properties\":{\"name\":{\"type\":\"string\"}}}"
    purpose: Validate named object properties.
    pitfall: Listed properties are optional unless required says otherwise.
  - keyword: required
    example: "{\"required\":[\"name\"]}"
    purpose: Require object property presence.
    pitfall: Presence does not exclude an empty string or null by itself.
  - keyword: additionalProperties
    example: "{\"additionalProperties\":false}"
    purpose: Restrict properties not covered by properties or patternProperties.
    pitfall: Composition can require unevaluatedProperties instead.
  - keyword: unevaluatedProperties
    example: "{\"unevaluatedProperties\":false}"
    purpose: Restrict properties left unevaluated across applicable subschemas.
    pitfall: Use a validator with the correct draft support.
  - keyword: items
    example: "{\"items\":{\"type\":\"integer\"}}"
    purpose: Validate array items with one schema.
    pitfall: It does not require a nonempty array.
  - keyword: prefixItems
    example: "{\"prefixItems\":[{\"type\":\"string\"},{\"type\":\"integer\"}]}"
    purpose: Validate positional array elements.
    pitfall: Length constraints are separate.
  - keyword: minItems
    example: "{\"minItems\":1}"
    purpose: Require a minimum array length.
    pitfall: It does not constrain each item’s type.
  - keyword: enum
    example: "{\"enum\":[\"json\",\"yaml\",\"toon\"]}"
    purpose: Accept one of an explicit set of values.
    pitfall: Values are case sensitive.
  - keyword: const
    example: "{\"const\":\"ready\"}"
    purpose: Accept one exact JSON value.
    pitfall: It can constrain more than strings.
  - keyword: minimum
    example: "{\"minimum\":0}"
    purpose: Set an inclusive numeric lower bound.
    pitfall: Strings are not numeric values.
  - keyword: pattern
    example: "{\"pattern\":\"^[A-Z]{2}$\"}"
    purpose: Validate a string with a regular expression.
    pitfall: Patterns are not anchored automatically.
  - keyword: allOf
    example: "{\"allOf\":[{\"type\":\"integer\"},{\"minimum\":0}]}"
    purpose: Require every subschema to pass.
    pitfall: It is logical intersection, not object inheritance.
  - keyword: anyOf
    example: "{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"number\"}]}"
    purpose: Require at least one passing subschema.
    pitfall: Multiple matches are allowed.
  - keyword: oneOf
    example: "{\"oneOf\":[{\"const\":\"a\"},{\"const\":\"b\"}]}"
    purpose: Require exactly one passing subschema.
    pitfall: Overlapping alternatives cause rejection.
  - keyword: format
    example: "{\"format\":\"date-time\"}"
    purpose: Annotate a string with a named semantic format.
    pitfall: Assertion behavior depends on the dialect and validator.
