Skip to content

Interface: ObjectSchemaProperty

core.ObjectSchemaProperty

Fields that may be set on a schema property in the properties definition of an object schema.

Properties

displayName

Optional displayName: string

Without a displayName, a property's key will become the user-visible name. This isn't ideal because the key must also be used by the Coda formula language to refer to the property, requiring lossy transformation.

You probably want to set displayName if: - You want a display name with punctuation (e.g., "Version(s)", "Priority/Urgency", "Done?", "Alice's Thing") - Your property key is not appropriate to show to an end-user (e.g., "custom_field_123")

Only supported for top-level properties of a sync table.

Defined in

schema.ts:908


fixedId

Optional fixedId: string

Optional fixed ID for this property, used to support renames of properties over time. If specified, changes to the name of this property will not cause the property to be treated as a new property.

Only supported for top-level properties of a sync table.

Note that fixedIds must already be present on the existing schema prior to rolling out a name change in a new schema; adding fixedId and a name change in a single schema version change will not work.

Defined in

schema.ts:932


fromKey

Optional fromKey: string

The name of a field in a return value object that should be re-mapped to this property. This provides a way to rename fields from API responses without writing code.

Suppose that you're fetching an object from an API that has a property called "duration". But in your pack, you'd like the value to be called "durationSeconds" to be more precise. You could write code in your execute function to relabel the field, but you could also use fromKey and Coda will do it for you.

Suppose your execute function looked like this:

execute: async function(context) {
  const response = await context.fetcher.fetch({method: "GET", url: "/api/some-entity"});
  // Suppose the body of the response looks like {duration: 123, name: "foo"}.
  return response.body;
}

You can define your schema like this:

coda.makeObjectSchema({
  properties: {
    name: {type: coda.ValueType.String},
    durationSeconds: {type: coda.ValueType.Number, fromKey: "duration"},
  },
});

This tells Coda to transform your formula's return value, creating a field "durationSeconds" whose value comes another field called "duration".

Defined in

schema.ts:895


mutable

Optional mutable: boolean

Whether this object schema property is editable by the user in the UI.

Only supported for top-level properties of a sync table.

Defined in

schema.ts:921


required

Optional required: boolean

When true, indicates that an object return value for a formula that has this schema must include a non-empty value for this property.

Defined in

schema.ts:914