---
name: "json-schema-builder"
description: "Infer a conservative JSON Schema from examples and explain uncertain constraints. Use when the user needs: Get a draft-2020-12 schema and validation cases."
license: "MIT"
metadata: {"version": "2026-10-17.1", "category": "data-parsing", "publisher": "AIDiveForge"}
---

# JSON Schema Builder

Get a draft-2020-12 schema and validation cases.

## Requirements

Provide examples and any explicit business constraints; jsonschema is optional for local validation.

## Workflow

1. Inventory every observed property and type across all examples, including absent keys and null values.
2. Require a property only when the supplied contract says it is required; presence in a small sample is not sufficient evidence.
3. Use explicit types and item schemas. Do not infer enums, numeric limits or formats from incidental sample values.
4. Validate each supplied example and at least one intended rejection case using an available validator.
5. List choices that need confirmation, including additional properties and missing versus nullable values.

## Worked example

Read `examples/input.txt` and `examples/expected.txt` before adapting the workflow.

## Acceptance checks

Both examples validate; an object without id and an object with an extra key are rejected.

## Limits

Examples cannot reveal every valid future value. The schema is a proposal until the contract owner confirms it.

Worked example included. Model-specific performance and vendor compatibility have not been benchmarked.
