Skip to content

Function: makeObjectSchema

makeObjectSchema<K, L, T>(schemaDef): T & { identity?: Identity ; type: Object }

A wrapper for creating a schema definition for an object value.

It is always recommended to use wrapper functions for creating top-level schema objects rather than specifying object literals. Wrappers validate your schemas at creation time, provide better TypeScript type inference, and can reduce boilerplate.

example

coda.makeObjectSchema({
  id: "email",
  primary: "name",
  properties: {
    email: {type: coda.ValueType.String, required: true},
    name: {type: coda.ValueType.String, required: true},
  },
});

Type parameters

Name Type
K extends string
L extends string
T extends Omit<ObjectSchemaDefinition<K, L>, "type">

Parameters

Name Type
schemaDef T & { type?: Object }

Returns

T & { identity?: Identity ; type: Object }

Defined in

schema.ts:985