MCPcopy
hub / github.com/colinhacks/zod / emit

Method emit

packages/zod/src/v4/core/json-schema-generator.ts:111–125  ·  view source on GitHub ↗

* Emit the final JSON Schema after processing. * Must call process() first.

(schema: schemas.$ZodType, _params?: EmitParams)

Source from the content-addressed store, hash-verified

109 * Must call process() first.
110 */
111 emit(schema: schemas.$ZodType, _params?: EmitParams): JSONSchema.BaseSchema {
112 // Apply emit params to the context
113 if (_params) {
114 if (_params.cycles) this.ctx.cycles = _params.cycles;
115 if (_params.reused) this.ctx.reused = _params.reused;
116 if (_params.external) this.ctx.external = _params.external;
117 }
118
119 extractDefs(this.ctx, schema);
120 const result = finalize(this.ctx, schema);
121
122 // Strip ~standard property to match old implementation's return type
123 const { "~standard": _, ...plainResult } = result as any;
124 return plainResult as JSONSchema.BaseSchema;
125 }
126}

Callers

nothing calls this directly

Calls 2

extractDefsFunction · 0.90
finalizeFunction · 0.90

Tested by

no test coverage detected