Skip to content

Interface: ObjectSchemaDefinition<K, L>

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[]

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

See makeAttributionNode.

Only supported in Superhuman Docs.


codaType?

optional codaType: Person | Reference | SelectList

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

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


createdAtProperty?

optional createdAtProperty: PropertyIdentifier<K>

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?

optional createdByProperty: PropertyIdentifier<K>

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?

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


displayProperty?

optional displayProperty: K

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 Superhuman Docs 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[]

Deprecated

Use ObjectSchemaDefinition.featuredProperties


featuredProperties?

optional featuredProperties: L[]

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.

Only supported in Superhuman Docs.


id?

optional id: K

Deprecated

Use ObjectSchemaDefinition.idProperty


identity?

optional identity: IdentityDefinition

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


idProperty?

optional idProperty: K

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>

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

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 Superhuman Docs: they cannot be used natively in the formula language and will not have correct types in Superhuman Docs. But, in certain scenarios they can be useful.

Only supported in Superhuman Docs.


index?

optional index: IndexDefinition

Defines how to index objects for use with full-text indexing.

Only supported in Superhuman Go.


linkProperty?

optional linkProperty: PropertyIdentifier<K>

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?

optional modifiedAtProperty: PropertyIdentifier<K>

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?

optional modifiedByProperty: PropertyIdentifier<K>

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?

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: sdk.ValueType.String,
     codaType: sdk.ValueHintType.SelectList,
     mutable: true,
     options: ['red', 'green', 'blue'],
  },
  user: {
     type: sdk.ValueType.String,
     codaType: sdk.ValueHintType.SelectList,
     mutable: true,
     options: async function (context) {
       let url = sdk.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

Deprecated

Use ObjectSchemaDefinition.displayProperty


properties

properties: ObjectSchemaProperties<K | L>

Definition of the key-value pairs in this object.


requireForUpdates?

optional requireForUpdates: boolean

Blocks updates from being sent with a blank value.

Inherited from

PropertyWithOptions.requireForUpdates


snippetProperty?

optional snippetProperty: PropertyIdentifier<K>

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>[]

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>

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

Identifies this schema as an object schema.


userEmailProperty?

optional userEmailProperty: PropertyIdentifier<K>

For cases where the object being synced represents a user, the name of the property within ObjectSchemaDefinition.properties that identifies the email address of the user.

Must be a ValueType.String property with the ValueHintType.Email hint or a ValueType.Object with the ValueHintType.Person hint.