Interface: ObjectSchemaDefinition<K, L>¶
Defined in: schema.ts:1351
A schema definition for an object value (a value with key-value pairs).
Extends¶
BaseSchema.PropertyWithOptions<{ }>
Type Parameters¶
| Type Parameter |
|---|
K extends string |
L extends string |
Properties¶
attribution?¶
optionalattribution:AttributionNode[]
Defined in: schema.ts:1412
Attribution text, images, and/or links that should be rendered along with this value.
See makeAttributionNode.
codaType?¶
optionalcodaType:Person|Reference|SelectList
Defined in: schema.ts:1382
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.
createdAtProperty?¶
optionalcreatedAtProperty:PropertyIdentifier<K>
Defined in: schema.ts:1467
The name of a property within ObjectSchemaDefinition.properties that can be interpreted as the creation datetime of the object.
Must be a ValueType.String or ValueType.Number property with the ValueHintType.Date or ValueHintType.DateTime hints
createdByProperty?¶
optionalcreatedByProperty:PropertyIdentifier<K>
Defined in: schema.ts:1475
The name of a property within ObjectSchemaDefinition.properties that can be interpreted as the creator of the object.
Must be a ValueType.String property with the ValueHintType.Email hint or a ValueType.Object with the ValueHintType.Person hint
description?¶
optionaldescription: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?¶
optionaldisplayProperty:K
Defined in: schema.ts:1374
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.
featured?¶
optionalfeatured:L[]
Defined in: schema.ts:1384
Deprecated¶
Use ObjectSchemaDefinition.featuredProperties
featuredProperties?¶
optionalfeaturedProperties:L[]
Defined in: schema.ts:1401
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?¶
optionalid:K
Defined in: schema.ts:1359
Deprecated¶
Use ObjectSchemaDefinition.idProperty
identity?¶
optionalidentity:IdentityDefinition
Defined in: schema.ts:1406
An identity for this schema, if this schema is important enough to be named and referenced. See IdentityDefinition.
idProperty?¶
optionalidProperty:K
Defined in: schema.ts:1364
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?¶
optionalimageProperty:PropertyIdentifier<K>
Defined in: schema.ts:1459
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?¶
optionalincludeUnknownProperties:boolean
Defined in: schema.ts:1422
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.
index?¶
optionalindex:IndexDefinition
Defined in: schema.ts:1549
Defines how to index objects for use with full-text indexing.
linkProperty?¶
optionallinkProperty:PropertyIdentifier<K>
Defined in: schema.ts:1438
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.
modifiedAtProperty?¶
optionalmodifiedAtProperty:PropertyIdentifier<K>
Defined in: schema.ts:1483
The name of a property within ObjectSchemaDefinition.properties that can be interpreted as the last modified datetime of the object.
Must be a ValueType.String or ValueType.Number property with the ValueHintType.Date or ValueHintType.DateTime hints
modifiedByProperty?¶
optionalmodifiedByProperty:PropertyIdentifier<K>
Defined in: schema.ts:1491
The name of a property within ObjectSchemaDefinition.properties that can be interpreted as the last modifier of the object.
Must be a ValueType.String property with the ValueHintType.Email hint or a ValueType.Object with the ValueHintType.Person hint
options?¶
optionaloptions: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¶
primary?¶
optionalprimary:K
Defined in: schema.ts:1366
Deprecated¶
Use ObjectSchemaDefinition.displayProperty
properties¶
properties:
ObjectSchemaProperties<K|L>
Defined in: schema.ts:1357
Definition of the key-value pairs in this object.
requireForUpdates?¶
optionalrequireForUpdates:boolean
Defined in: schema.ts:271
Blocks updates from being sent with a blank value.
Inherited from¶
PropertyWithOptions.requireForUpdates
snippetProperty?¶
optionalsnippetProperty:PropertyIdentifier<K>
Defined in: schema.ts:1451
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?¶
optionalsubtitleProperties:PropertyIdentifier<K>[]
Defined in: schema.ts:1444
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?¶
optionaltitleProperty:PropertyIdentifier<K>
Defined in: schema.ts:1430
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:1355
Identifies this schema as an object schema.