Skip to content

Interface: ObjectSchemaDefinition<K, L>

core.ObjectSchemaDefinition

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

Type parameters

Name Type
K extends string
L extends string

Hierarchy

ObjectSchemaDefinition

Properties

attribution

Optional attribution: AttributionNode[]

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

See makeAttributionNode.

Defined in

schema.ts:1120


codaType

Optional codaType: Person | Reference | SelectList

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.

Defined in

schema.ts:1090


description

Optional description: string

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

Defined in

schema.ts:285


displayProperty

Optional displayProperty: K

The name of a property within 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.

Defined in

schema.ts:1082


Optional featured: L[]

Deprecated

Use featuredProperties

Defined in

schema.ts:1092


featuredProperties

Optional featuredProperties: L[]

A list of property names from within 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.

Defined in

schema.ts:1109


id

Optional id: K

Deprecated

Use idProperty

Defined in

schema.ts:1067


idProperty

Optional idProperty: K

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

Defined in

schema.ts:1072


identity

Optional identity: IdentityDefinition

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

Defined in

schema.ts:1114


imageProperty

Optional imageProperty: PropertyIdentifier<K>

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

Must be a String property with the ImageAttachment or ImageReference hints

Defined in

schema.ts:1167


includeUnknownProperties

Optional includeUnknownProperties: boolean

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.

Defined in

schema.ts:1130


linkProperty

Optional linkProperty: PropertyIdentifier<K>

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

Must be a String property with a Url codaType.

Defined in

schema.ts:1146


options

Optional options: PropertySchemaOptions<{}>

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

Defined in

schema.ts:264


primary

Optional primary: K

Deprecated

Use displayProperty

Defined in

schema.ts:1074


properties

properties: ObjectSchemaProperties<K | L>

Definition of the key-value pairs in this object.

Defined in

schema.ts:1065


requireForUpdates

Optional requireForUpdates: boolean

Blocks updates from being sent with a blank value.

Inherited from

PropertyWithOptions.requireForUpdates

Defined in

schema.ts:271


snippetProperty

Optional snippetProperty: PropertyIdentifier<K>

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

Must be a String property or Array of Strings.

Defined in

schema.ts:1159


subtitleProperties

Optional subtitleProperties: PropertyIdentifier<K>[]

A list of property names from within 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 featuredProperties if not specified.

Defined in

schema.ts:1152


titleProperty

Optional titleProperty: PropertyIdentifier<K>

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 displayProperty if not specified

Must be a String property

Defined in

schema.ts:1138


type

type: Object

Identifies this schema as an object schema.

Defined in

schema.ts:1063