WP62: Nish classes from a JSON Schema
State: Proposed · Done: 0 of 5 · Design note: docs/wp62-json-schema-classes.md
Stages
- S1: typed JSON prerequisites: an optional field whose default the constructor assigns (
[],new Map(),new C(),new JsonNumber()), with NL2498 reworded, a per-classunknown: "ignore" | "error"option,new JsonNumber()in a coerce class, and thedocs/security/json.mdupdate - S2:
nish schemafor plain objects: scalars, strings, arrays,requiredandoptional, the default rule with its warning,additionalPropertiesasunknown, every annotation as JSDoc, names andrename, a deterministic file with a header, itsFlags:line and--check, every other keyword refused with its JSON Pointer - S3:
$defsand$ref, maps, nullables, tagged unions fromconstand OpenAPI'sdiscriminator, the flatallOfmerge, recursion through arrays, maps and| null - S4: validation keywords onto WP61's
constraintsliteral,formatchecked by default, after WP61's "S1: constraints in decode"; the transitive coerce switch after its "S2: coercion" - S5: the vendored schema corpus with per-schema counts, the guide page, and the reverse generator if taken (owner's decisions)
Next
S1: §12, and the keyword table it works from, §4.
Waiting on a decision
§10: whether the typed JSON prerequisites land as WP62's S1 or in WP61, a reverse generator, readOnly/writeOnly, unknown and x-* keywords, nullable boolean and type-discriminated unions, presence flags, field-name style, where the generator lives, and whether format is checked by default.
Not planned
A runtime schema interpreter, untagged unions by trial decoding, string enums, leaving absent optional keys out of the encoding, one file per $defs entry, OpenAPI 3.0, servers or clients from OpenAPI paths, a schema fetched over the network.

