Function: restorePortableValue()
restorePortableValue(
value,jsonSchema):unknown
Defined in: packages/workflow-engine/src/ai/schema-portability.ts:463
value (a model's parsed JSON reply) brought back to the shape of the
ORIGINAL schema — the one toPortableJsonSchema(…, "openai") was fed —
so the caller's Zod schema parses it: every null is removed where the
schema has an optional, non-nullable property, and every record the
target received as { key, value } pairs is rebuilt into an object.
Nested objects, arrays, union members and $defs are covered; a null
the original schema admits (required or .nullable()) is kept. Never
mutates its input.
Parameters
value
unknown
jsonSchema
unknown
Returns
unknown