Summary
Perry miscompiles the per-property type guards in ajv's standalone-generated validators: for a schema with typed properties, invalid inputs are accepted as valid. Surfaced by #1680.
Repro (via ajv/standalone output)
Schema:
{ $id: "User", type: "object",
properties: { name: { type: "string" }, age: { type: "number" }, active: { type: "boolean" } },
required: ["name", "age"], additionalProperties: false }
Generate the standalone validator with new Ajv({ code: { source: true } }) + standaloneCode(...), import it, and run:
validate({ name: "Ada", age: "old" }); // node: false (age not a number) — perry: true
validate({ name: "Ada", age: 5, active: "yes" }); // node: false (active not boolean) — perry: true
validate({ name: "Ada", age: 1.5 }); // (integer schema) node: false — perry: true
type: string rejection works for a number value but not a boolean; type: number/type: boolean/type: integer rejection fail. The structural subset (object / required / additionalProperties, empty property schemas) is fully parity-clean — see test-files/test_ajv_standalone.ts.
Notes
Minimal repros of the individual pieces (typeof v !== "string" on a boolean param-property, x % 1 on a float) pass in isolation, so this is an interaction within ajv's dense generated structure (const _errs = errors; … if(errors === _errs){ … } nesting around each property guard), not one of those primitives alone. The generated validator file is the concrete repro. Blocks full-coverage ajv under #1680; the structural subset is unblocked.
Summary
Perry miscompiles the per-property
typeguards in ajv'sstandalone-generated validators: for a schema with typed properties, invalid inputs are accepted as valid. Surfaced by #1680.Repro (via ajv/standalone output)
Schema:
Generate the standalone validator with
new Ajv({ code: { source: true } })+standaloneCode(...), import it, and run:type: stringrejection works for a number value but not a boolean;type: number/type: boolean/type: integerrejection fail. The structural subset (object / required / additionalProperties, empty property schemas) is fully parity-clean — seetest-files/test_ajv_standalone.ts.Notes
Minimal repros of the individual pieces (
typeof v !== "string"on a boolean param-property,x % 1on a float) pass in isolation, so this is an interaction within ajv's dense generated structure (const _errs = errors; … if(errors === _errs){ … }nesting around each property guard), not one of those primitives alone. The generated validator file is the concrete repro. Blocks full-coverage ajv under #1680; the structural subset is unblocked.