Features
Implement Standard JSON Schema
standard-schema/standard-schema#134
Implement z.fromJSONSchema()
const jsonSchema = {
type: "object",
properties: {
name: { type: "string" },
age: { type: "number" }
},
required: ["name"]
};
const schema = z.fromJSONSchema(jsonSchema);Implement z.xor()
const schema = z.xor(
z.object({ type: "user", name: z.string() }),
z.object({ type: "admin", role: z.string() })
);
// Exactly one of the schemas must matchImplement z.looseRecord()
const schema = z.looseRecord(z.string(), z.number());
// Allows additional properties beyond those defined