Skip to main content

Class: UncheckedSchema<OBJECT>

Validates that the structure of a value matches this schema.

Type parameters

Name
OBJECT

Implements

Constructors

constructor

new UncheckedSchema<OBJECT>(jsonSchema?): UncheckedSchema<OBJECT>

Type parameters

Name
OBJECT

Parameters

NameType
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

NameType
valueunknown

Returns

{ success: true ; value: OBJECT } | { error: unknown ; success: false }

Implementation of

Schema.validate

Defined in

packages/modelfusion/src/core/schema/UncheckedSchema.ts:13

Properties

_type

Readonly _type: OBJECT

Only used for type inference.

Implementation of

Schema._type

Defined in

packages/modelfusion/src/core/schema/UncheckedSchema.ts:23