← All notes

JSON Schema enum, allOf, anyOf, oneOf and not

Answer: enum restricts a value to a fixed set; it must be an array with at least one element, where each element is unique. The keywords used to combine schemas are the following:

| Keyword | Meaning | |---|---| | allOf | (AND) valid against all of the subschemas | | anyOf | (OR) valid against any of the subschemas | | oneOf | (XOR) valid against exactly one of the subschemas | | not | (NOT) the value fails the given schema |

Notes

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: json-schema-org/website (GitHub), Understanding JSON Schema: enum, BSD-3-Clause (https://raw.githubusercontent.com/json-schema-org/website/main/LICENSE). Copyright (c) 2022 JSON Schema Specification Authors; json-schema-org/website (GitHub), Understanding JSON Schema: schema composition, BSD-3-Clause (https://raw.githubusercontent.com/json-schema-org/website/main/LICENSE). Copyright (c) 2022 JSON Schema Specification Authors; pydantic/pydantic (GitHub), JSON Schema (Pydantic docs), MIT (https://raw.githubusercontent.com/pydantic/pydantic/main/LICENSE). Copyright (c) 2017 to present Pydantic Services Inc. and individual contributors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: json-schema-org/website (GitHub), Understanding JSON Schema: enum, BSD-3-Clause (https://raw.githubusercontent.com/json-schema-org/website/main/LICENSE). Copyright (c) 2022 JSON Schema Specification Authors; json-schema-org/website (GitHub), Understanding JSON Schema: schema composition, BSD-3-Clause (https://raw.githubusercontent.com/json-schema-org/website/main/LICENSE). Copyright (c) 2022 JSON Schema Specification Authors; pydantic/pydantic (GitHub), JSON Schema (Pydantic docs), MIT (https://raw.githubusercontent.com/pydantic/pydantic/main/LICENSE). Copyright (c) 2017 to present Pydantic Services Inc. and individual contributors.

Cite this

Permanent ID: iil:note:5vd2q6hq

iinventedlight. 2026. "JSON Schema enum, allOf, anyOf, oneOf and not." iinventedlight Library, iil:note:5vd2q6hq, version of 2026-11-16. https://iinventedlight.com/library/notes/ao-structured-json-schema-composition/. License: CC-BY-4.0.

@misc{iil_note_5vd2q6hq,
  author = {{iinventedlight}},
  title = {{JSON Schema enum, allOf, anyOf, oneOf and not}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/ao-structured-json-schema-composition/},
  note = {Permanent ID iil:note:5vd2q6hq. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-structured-json-schema-composition.md.