Class: ZodSchema<OBJECT>
Validates that the structure of a value matches this schema.
Type parameters
Name |
---|
OBJECT |
Implements
Schema
<OBJECT
>JsonSchemaProducer
Constructors
constructor
• new ZodSchema<OBJECT
>(zodSchema
): ZodSchema
<OBJECT
>
Type parameters
Name |
---|
OBJECT |
Parameters
Name | Type |
---|---|
zodSchema | ZodType <OBJECT , ZodTypeDef , OBJECT > |
Returns
ZodSchema
<OBJECT
>
Defined in
packages/modelfusion/src/core/schema/ZodSchema.ts:14
Methods
getJsonSchema
▸ getJsonSchema(): unknown
Returns the JSON schema for this schema. The schema has to be a valid JSON schema in object form.
Returns
unknown
Implementation of
JsonSchemaProducer.getJsonSchema
Defined in
packages/modelfusion/src/core/schema/ZodSchema.ts:28
validate
▸ validate(value
): { success
: true
; value
: OBJECT
} | { error
: unknown
; success
: false
}
Validates that the structure of a value matches this schema, and returns a typed version of the value if it does.
Parameters
Name | Type |
---|---|
value | unknown |
Returns
{ success
: true
; value
: OBJECT
} | { error
: unknown
; success
: false
}
Implementation of
Defined in
packages/modelfusion/src/core/schema/ZodSchema.ts:18
Properties
_partialType
• Readonly
_partialType: PartialDeep
<OBJECT
, { recurseIntoArrays
: true
}>
Use only for typing purposes. The value is always undefined
.
Defined in
packages/modelfusion/src/core/schema/ZodSchema.ts:40
_type
• Readonly
_type: OBJECT
Use only for typing purposes. The value is always undefined
.
Implementation of
Defined in
packages/modelfusion/src/core/schema/ZodSchema.ts:35
zodSchema
• Readonly
zodSchema: ZodType
<OBJECT
, ZodTypeDef
, OBJECT
>