Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Field Definition

Francis Pion edited this page Jan 20, 2025 · 5 revisions

ℹ️ Defines the fields/properties shared by contents of the same type.

⚙️ Properties

Name Type Cardinality Description
Id Guid 1..1 🗝️ The unique identifier of the field. Should be used as the id HTML attribute.
ContentType ContentType 1..1 The ContentType in which this field resides.
FieldType FieldType 1..1 The FieldType associated to this field.
Order Int32 1..1 🗝️ The order of the field within the content type.
IsInvariant Boolean 1..1 A value indicating whether or not fields values can be translated.
IsRequired Boolean 1..1 A value indicating whether or not a field value is required.
IsIndexed Boolean 1..1 A value indicating whether or not field values are indexed (field value index table).
IsUnique Boolean 1..1 A value indicating whether or not field values are unique within the content type (unique value index table).
UniqueName String 1..1 🗝️ The unique name of the field definition. Should be used as the name HTML attribute.
DisplayName String 0..1 The display name of the field definition. Should be used as the field <label>.
Description String 0..1 A textual description of the content type. Should be used as an HTML tooltip.
Placeholder String 0..1 A short string describing the field to users. Should be used as the placeholder HTML attribute.

❔ Questions

🚧 What are example of invariant fields? Should not all fields be translatable?

🚧 Can fields have a value for the invariant and locales?

🚧 Are fields required when saving a draft or when publishing content?

⚠️ Currently, field values are not saved when creating content.

🚧 Should RichText fields be indexable?

⚠️ It does not really make sense, but at the same time we would like using Full-Text Search.

🚧 Should RichText fields be unique?

⚠️ It does not really make sense.

🚧 Should all unique fields be indexed?

💡 Since the tables are separate, the booleans could be separate.

🚧 What happens to field values when their associated field definition is deleted?

🚧 Should we provide queries for field definitions instead of simply working with the ContentType in which they exist?

🌐 Endpoints

Status Method URL Description
0% DELETE /api/contents/types/{contentTypeId}/fields/{fieldId} Deletes a field definition.
75% PATCH /api/contents/types/{contentTypeId}/fields/{fieldId} Updates a field definition.
75% POST /api/contents/types/{contentTypeId}/fields Creates a new field definition.
75% PUT /api/contents/types/{contentTypeId}/fields/{fieldId} Creates or replaces a field definition.