Dynamic Items
While some items come in well-defined shapes, others, such as a database record or a spreadsheet row, don't have a definitive one. Or maybe it's a mix of the two, with an item that support custom fields. A connector can easily support these use cases by dynamically building the schema of its items.
const schema: FieldSchema[] = [
{
name: 'id',
label: 'Unique ID',
type: FieldValueType.STRING,
}
];
for await (const customField of fetch(...)) {
schema.push({
name: customField.name,
label: customField.label,
type: customField.type
})
}
return schema
Be careful to properly map the types of your dynamic fields to ones that are supported by the specification.