@@ -114,7 +114,16 @@ export interface FieldOption {
114114 * The Protocol Constitution (SpecField) defines the core field schema.
115115 * This adds runtime conveniences and extensions.
116116 *
117- * We make certain spec fields optional since Zod applies defaults at parse time.
117+ * Properties from the protocol Field interface that are re-declared here:
118+ * - `name`, `label`: Made optional for runtime convenience (auto-populated from Record key)
119+ * - `type`: Extended union type to include runtime-specific types (vector, grid, location, object)
120+ * - `options`: Extended to allow numeric values for backwards compatibility
121+ * - Boolean flags (`required`, `multiple`, `unique`, `hidden`, `readonly`, `encryption`, `index`, `externalId`):
122+ * Made optional since Zod applies defaults at parse time, but runtime usage typically specifies these explicitly
123+ * - `deleteBehavior`: Made optional with protocol-compatible enum values
124+ *
125+ * All other protocol properties (description, defaultValue, maxLength, minLength, precision, scale, min, max,
126+ * reference, referenceFilters, writeRequiresMasterRead, expression, formula, summaryOperations) are inherited as-is.
118127 */
119128export interface FieldConfig extends Omit < Field , 'name' | 'label' | 'type' | 'options' | 'required' | 'multiple' | 'unique' | 'deleteBehavior' | 'hidden' | 'readonly' | 'encryption' | 'index' | 'externalId' > {
120129 /** Field name (inferred from Record key when used in ObjectConfig.fields) */
@@ -166,7 +175,32 @@ export interface FieldConfig extends Omit<Field, 'name' | 'label' | 'type' | 'op
166175
167176 /**
168177 * Reference to another object for lookup/master_detail fields.
169- * @deprecated Use 'reference' from SpecField instead
178+ *
179+ * @deprecated Legacy alias for the protocol-level `reference` field (inherited from {@link Field}).
180+ *
181+ * **Migration Guidance:**
182+ * - **New schemas MUST** use the `reference` field (defined in the protocol Field interface) instead of `reference_to`.
183+ * - **During migration**, engines and tooling SHOULD:
184+ * - Treat `reference_to` as a fallback alias for `reference` (i.e., if `reference` is undefined and `reference_to`
185+ * is defined, behave as though `reference` were set to the same value).
186+ * - Prefer the protocol `reference` value when both are present.
187+ * - This property is retained only for backward compatibility with older *.object.yml definitions and will be
188+ * removed in a future major version once all callers have migrated to `reference`.
189+ *
190+ * @example
191+ * ```yaml
192+ * # Old (deprecated):
193+ * fields:
194+ * owner:
195+ * type: lookup
196+ * reference_to: users
197+ *
198+ * # New (protocol-compliant):
199+ * fields:
200+ * owner:
201+ * type: lookup
202+ * reference: users
203+ * ```
170204 */
171205 reference_to ?: string ;
172206
@@ -207,12 +241,6 @@ export interface FieldConfig extends Omit<Field, 'name' | 'label' | 'type' | 'op
207241 */
208242 min_height ?: number ;
209243
210- /**
211- * Regular expression pattern for validation.
212- * @deprecated Use validation.pattern instead
213- */
214- regex ?: string ;
215-
216244 /**
217245 * Field validation configuration.
218246 * Defines validation rules applied at the field level.
@@ -230,10 +258,11 @@ export interface FieldConfig extends Omit<Field, 'name' | 'label' | 'type' | 'op
230258 min_length ?: number ;
231259 /** Maximum length for strings */
232260 max_length ?: number ;
233- /** Regular expression pattern for validation */
261+ /**
262+ * Regular expression pattern for validation.
263+ * Use this for custom pattern matching (e.g., /^[A-Z]{2}\d{4}$/ for codes).
264+ */
234265 pattern ?: string ;
235- /** Regex pattern (alias for pattern) */
236- regex ?: string ;
237266 /** Custom validation message */
238267 message ?: string ;
239268 } ;
0 commit comments