API Reference
SchemaStream
Constructor Options
schema
: Zod schema defining the structure of your dataoptions
:defaultData
: Initial values for schema propertiestypeDefaults
: Default values for primitive typesonKeyComplete
: Callback for tracking parsing progress
Working with Defaults
There are two ways to provide default values in schema-stream:
1. Via Zod Schema
2. Via Constructor Options
Priority order:
- Explicit
defaultData
values - Zod schema defaults
- Global
typeDefaults
null
(if no other default is found)
Completion Tracking
Track the progress of parsing with path information:
Parse Options
stringBufferSize
: Size of the buffer for string values (default: 0)handleUnescapedNewLines
: Handle unescaped newlines in JSON (default: true)
Schema Stub Utility
Create a typed stub of your schema with defaults: