Class: UncheckedSchema<OBJECT>
Validates that the structure of a value matches this schema.
Type parameters
Name |
---|
OBJECT |
Implements
Schema
<OBJECT
>JsonSchemaProducer
Constructors
constructor
• new UncheckedSchema<OBJECT
>(jsonSchema?
): UncheckedSchema
<OBJECT
>
Type parameters
Name |
---|
OBJECT |
Parameters
Name | Type |
---|---|
jsonSchema? | unknown |
Returns
UncheckedSchema
<OBJECT
>
Defined in
packages/modelfusion/src/core/schema/UncheckedSchema.ts:11
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/UncheckedSchema.ts:19
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/UncheckedSchema.ts:13
Properties
_type
• Readonly
_type: OBJECT
Only used for type inference.