Skip to content

Interface: ObjectSchemaDefinition<K, L>

Defined in: schema.ts:1299

A schema definition for an object value (a value with key-value pairs).

Extends

Type Parameters

Type Parameter
K extends string
L extends string

Properties

attribution?

optional attribution: AttributionNode[]

Defined in: schema.ts:1360

Attribution text, images, and/or links that should be rendered along with this value.

See makeAttributionNode.


codaType?

optional codaType: Person | Reference | SelectList

Defined in: schema.ts:1330

A hint for how Coda should interpret and render this object value.

For example, an object can represent a person (user) in a Coda doc, with properties for the email address of the person and their name. Using ValueHintType.Person tells Coda to render such a value as an @-reference to that person, rather than a basic object chip.


description?

optional description: string

Defined in: schema.ts:285

A explanation of this object schema property shown to the user in the UI.

If your pack has an object schema with many properties, it may be useful to explain the purpose or contents of any property that is not self-evident.

Inherited from

BaseSchema.description


displayProperty?

optional displayProperty: K

Defined in: schema.ts:1322

The name of a property within ObjectSchemaDefinition.properties that be used to label this object in the UI. Object values can contain many properties and the Coda UI will display them as a "chip" with only the value of the "displayProperty" property used as the chip's display label. The other properties can be seen when hovering over the chip.


optional featured: L[]

Defined in: schema.ts:1332

Deprecated

Use ObjectSchemaDefinition.featuredProperties


featuredProperties?

optional featuredProperties: L[]

Defined in: schema.ts:1349

A list of property names from within ObjectSchemaDefinition.properties for the "featured" properties of this object, used in sync tables. When a sync table is first added to a document, columns are created for each of the featured properties. The user can easily add additional columns for any other properties, as desired. All featured properties need to be top-level. If you can't or don't want to change the received data format, consider changing the received object after fetching and before returning and assigning it to the schema.

This distinction exists for cases where a sync table may include dozens of properties, which would create a very wide table that is difficult to use. Featuring properties allows a sync table to be created with the most useful columns created by default, and the user can add additional columns as they find them useful.

Non-featured properties can always be referenced in formulas regardless of whether column projections have been created for them.


id?

optional id: K

Defined in: schema.ts:1307

Deprecated

Use ObjectSchemaDefinition.idProperty


identity?

optional identity: IdentityDefinition

Defined in: schema.ts:1354

An identity for this schema, if this schema is important enough to be named and referenced. See IdentityDefinition.


idProperty?

optional idProperty: K

Defined in: schema.ts:1312

The name of a property within ObjectSchemaDefinition.properties that represents a unique id for this object. Sync table schemas must specify an id property, which uniquely identify each synced row.


imageProperty?

optional imageProperty: PropertyIdentifier<K>

Defined in: schema.ts:1407

The name of a property within ObjectSchemaDefinition.properties that can be used as a rich image preview of the object.

Must be a ValueType.String property with the ValueHintType.ImageAttachment or ValueHintType.ImageReference hints


includeUnknownProperties?

optional includeUnknownProperties: boolean

Defined in: schema.ts:1370

Specifies that object instances with this schema can contain additional properties not defined in the schema, and that the packs infrastructure should retain these unknown properties rather than stripping them.

Properties not declared in the schema will not work properly in Coda: they cannot be used natively in the formula language and will not have correct types in Coda. But, in certain scenarios they can be useful.


linkProperty?

optional linkProperty: PropertyIdentifier<K>

Defined in: schema.ts:1386

The name of a property within ObjectSchemaDefinition.properties that will navigate users to more details about this object

Must be a ValueType.String property with a ValueHintType.Url ObjectSchemaDefinition.codaType.


options?

optional options: PropertySchemaOptions<{ }>

Defined in: schema.ts:264

A list of values or a formula that returns a list of values to suggest when someone edits this property.

Example

properties: {
  color: {
     type: coda.ValueType.String,
     codaType: coda.ValueHintType.SelectList,
     mutable: true,
     options: ['red', 'green', 'blue'],
  },
  user: {
     type: coda.ValueType.String,
     codaType: coda.ValueHintType.SelectList,
     mutable: true,
     options: async function (context) {
       let url = coda.withQueryParams("https://example.com/userSearch", { name: context.search });
       let response = await context.fetcher.fetch({ method: "GET", url: url });
       let results = response.body.users;
       return results.map(user => {display: user.name, value: user.id})
     },
  },
}

Inherited from

PropertyWithOptions.options


primary?

optional primary: K

Defined in: schema.ts:1314

Deprecated

Use ObjectSchemaDefinition.displayProperty


properties

properties: ObjectSchemaProperties<K | L>

Defined in: schema.ts:1305

Definition of the key-value pairs in this object.


requireForUpdates?

optional requireForUpdates: boolean

Defined in: schema.ts:271

Blocks updates from being sent with a blank value.

Inherited from

PropertyWithOptions.requireForUpdates


snippetProperty?

optional snippetProperty: PropertyIdentifier<K>

Defined in: schema.ts:1399

The name of a property within ObjectSchemaDefinition.properties that be used as a textual summary of the object.

Must be a ValueType.String property or ValueType.Array of ValueType.Strings.


subtitleProperties?

optional subtitleProperties: PropertyIdentifier<K>[]

Defined in: schema.ts:1392

A list of property names from within ObjectSchemaDefinition.properties for the properties of the object to be shown in the subtitle of a rich card preview for formulas that return this object. Defaults to the value of ObjectSchemaDefinition.featuredProperties if not specified.


titleProperty?

optional titleProperty: PropertyIdentifier<K>

Defined in: schema.ts:1378

The name of a property within properties that will be used as a title of a rich card preview for formulas that return this object. Defaults to the value of ObjectSchemaDefinition.displayProperty if not specified

Must be a ValueType.String property


type

type: Object

Defined in: schema.ts:1303

Identifies this schema as an object schema.