| name | synthetic-schema-codegen-test |
| description | Sets up synthetic tests for jsonschemars codegen by creating a dummy Rust crate, generating Rust from JSON Schema definitions, analyzing compilation issues, and documenting findings in todo.txt with minimal viable examples. Use when running codegen analysis on external schemas, setting up regression test harnesses, or adding new bug entries to todo.txt. |
Synthetic Schema Codegen Test
Automates setup of a synthetic test harness: dummy crate,
jsonschemars generate rust, build analysis, and todo.txt updates. Use this
when analyzing codegen issues from external JSON Schema sources.
Synthetic Data Only
For every issue added to todo.txt, create synthetic minimal viable bug data.
Do not use real schemas from external sources (e.g. user-provided files). Use
placeholder schemas that reproduce the same error type. Example:
{"type":"object","properties":{"x":{"type":"string"}}} instead of referencing
actual schema content.
Workflow
1. Create Dummy Lib Crate
Create a lib crate at the desired location (e.g. schema_models/):
- Cargo.toml: Use the latest Rust edition and rust-version (match the
json-schema-rs workspace), path deps to json-schema-rs workspace
- Lints: Copy strict Rust and Clippy settings from workspace root
Cargo.toml
- lib.rs:
pub mod generated;
2. Run jsonschemars CLI
jsonschemars generate rust <path-to-schemas-dir> -o <path>/src/generated
Do not post-process the output. Leave all issues as-is for documentation.
3. Analyze Build Errors
Run each command in the dummy crate in a separate run so issues can be
categorized by tool: