Class: JSONSchemaGenerator
Defined in: packages/agentos/node_modules/zod/v4/core/json-schema-generator.d.cts:32
Legacy class-based interface for JSON Schema generation. This class wraps the new functional implementation to provide backward compatibility.
Deprecated
Use the toJSONSchema function instead for new code.
Example
// Legacy usage (still supported)
const gen = new JSONSchemaGenerator({ target: "draft-07" });
gen.process(schema);
const result = gen.emit(schema);
// Preferred modern usage
const result = toJSONSchema(schema, { target: "draft-07" });
Constructors
Constructor
new JSONSchemaGenerator(
params?):JSONSchemaGenerator
Defined in: packages/agentos/node_modules/zod/v4/core/json-schema-generator.d.cts:53
Parameters
params?
JSONSchemaGeneratorConstructorParams
Returns
JSONSchemaGenerator
Accessors
counter
Get Signature
get counter():
number
Defined in: packages/agentos/node_modules/zod/v4/core/json-schema-generator.d.cts:49
Deprecated
Access via ctx instead
Returns
number
Set Signature
set counter(
value):void
Defined in: packages/agentos/node_modules/zod/v4/core/json-schema-generator.d.cts:50
Parameters
value
number
Returns
void
io
Get Signature
get io():
"input"|"output"
Defined in: packages/agentos/node_modules/zod/v4/core/json-schema-generator.d.cts:47
Deprecated
Access via ctx instead
Returns
"input" | "output"
metadataRegistry
Get Signature
get metadataRegistry():
$ZodRegistry<Record<string,any>>
Defined in: packages/agentos/node_modules/zod/v4/core/json-schema-generator.d.cts:35
Deprecated
Access via ctx instead
Returns
$ZodRegistry<Record<string, any>>
override
Get Signature
get override(): (
ctx) =>void
Defined in: packages/agentos/node_modules/zod/v4/core/json-schema-generator.d.cts:41
Deprecated
Access via ctx instead
Returns
(
ctx):void
Parameters
ctx
jsonSchema
path
(string | number)[]
zodSchema
Returns
void
seen
Get Signature
get seen():
Map<$ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>,Seen>
Defined in: packages/agentos/node_modules/zod/v4/core/json-schema-generator.d.cts:52
Deprecated
Access via ctx instead
Returns
Map<$ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>, Seen>
target
Get Signature
get target():
"draft-04"|"draft-07"|"draft-2020-12"|"openapi-3.0"|object&string
Defined in: packages/agentos/node_modules/zod/v4/core/json-schema-generator.d.cts:37
Deprecated
Access via ctx instead
Returns
"draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | object & string
unrepresentable
Get Signature
get unrepresentable():
"throw"|"any"
Defined in: packages/agentos/node_modules/zod/v4/core/json-schema-generator.d.cts:39
Deprecated
Access via ctx instead
Returns
"throw" | "any"
Methods
emit()
emit(
schema,_params?):JSONSchema
Defined in: packages/agentos/node_modules/zod/v4/core/json-schema-generator.d.cts:63
Emit the final JSON Schema after processing. Must call process() first.
Parameters
schema
_params?
EmitParams
Returns
process()
process(
schema,_params?):JSONSchema
Defined in: packages/agentos/node_modules/zod/v4/core/json-schema-generator.d.cts:58
Process a schema to prepare it for JSON Schema generation. This must be called before emit().