Skip to content

EF.YAML.Attributes

Custom attributes for declarative mapping between Delphi properties and YAML metadata nodes. Used by KIDE for RTTI-based property discovery.

Attribute types:

  • YamlNode: optional scalar property (string, integer, boolean, enum)
  • YamlRequiredNode: required scalar property (ModelName, etc.)
  • YamlContainer: collection of N homogeneous children (Fields, Rules)
  • YamlSubNode: single sub-object with fixed properties (HTMLEditor, PreviewWindow)
  • YamlEnumValue: maps an enum ordinal to its YAML string representation

YamlNodeAttribute class

Marks a read-only property as mapped to an optional YAML node. This is the most common attribute — used for scalar values like IsVisible, DisplayWidth, PhysicalName, Expression, etc.

DefaultValue is stored as string (not Variant) because Delphi's RTTI attribute construction does not support Variant constructor parameters.

[YamlNode('IsVisible', 'True', 'Field visibility in the UI')]
property IsVisible: Boolean read GetIsVisible;

[YamlNode('DisplayLabel', '', 'Label shown in forms and grids', True)]
property DisplayLabel: string read GetDisplayLabel;  // localizable
pascal
constructor Create(const ANodePath, ADescription: string;

Optional node without an explicit default value. The implicit default depends on the property type ('' for string, 0 for integer, etc.)

pascal
constructor Create(const ANodePath: string;

Optional node with an explicit default value (as string representation).

pascal
constructor Create(const ANodePath: string;

Optional node with an explicit Integer default value. Lets a declaration reference a shared Integer constant instead of duplicating the literal as a string, e.g. [YamlNode('MaxTokens', KX_CLAUDE_DEF_MAXTOKENS, '...')]. The value is stored as its string representation.

pascal
constructor Create(const ANodePath: string;

Optional node with an explicit Boolean default value (stored as 'True'/'False'). Lets a declaration reference a shared Boolean constant.

pascal
property NodePath: string read FNodePath;

Slash-separated path to the YAML node (e.g. 'IsVisible', 'PreviewWindow/Width').

pascal
property DefaultValue: string read FDefaultValue;

Default value as string representation. Check HasDefaultValue to distinguish "no default" from "default is empty string".

pascal
property HasDefaultValue: Boolean read FHasDefaultValue;

True if an explicit default value was provided in the attribute constructor.

pascal
property Description: string read FDescription;

English description used as tooltip in KIDE and as code documentation.

pascal
property IsLocalizable: Boolean read FIsLocalizable;

When True, KIDE generates a secondary input for the alternate language (the node path with '2' suffix, e.g. 'DisplayLabel2').

YamlRequiredNodeAttribute class

Marks a read-only property as mapped to a required YAML node. KIDE displays these with bold label and asterisk. Few nodes are required: ModelName, ViewName, Model (in ViewTable), etc.

[YamlRequiredNode('ModelName', 'Unique model identifier')]
property ModelName: string read GetModelName;

YamlViewNodeAttribute class

Marks a node that is a VIEW: either a reference to an external view (the node's scalar value names an existing view) OR an inline view definition (the node carries children). Used for Config nodes such as HomeView and Login, which TKWebApplication resolves through FindViewByNode. KIDE, when the node is a name reference, checks that the referenced view exists. Inherits the scalar-node shape (NodePath, Description, optional default).

[YamlViewNode('HomeView', 'The application home view: a view name or an inline view definition')]
property HomeViewName: string read GetHomeViewName;

YamlConfigNodeAttribute class

Class-level attribute: declares that this class is the config reader/schema for a specific YAML node, identified by its full slash-separated path (e.g. 'HelpChat/Claude'). Lets a config class live in its own feature/domain unit and still be discovered by KIDE via RTTI, without the parent config class referencing it by type. KIDE scans the linked types for classes carrying this attribute and maps NodePath -> class.

[YamlConfigNode('HelpChat/Claude')]
TKClaudeProviderConfig = class
[YamlNode('Model', 'claude-haiku-4-5', 'Claude model id')]
property Model: string read FModel;
end;
pascal
constructor Create(const ANodePath: string);

Creates the attribute binding the decorated class to the YAML node at ANodePath (full path from the config root).

pascal
property NodePath: string read FNodePath;

Full slash-separated path of the YAML node this class describes.

YamlContainerAttribute class

Marks a read-only property as a container of N homogeneous children. KIDE renders this as an expandable tree node with an "Add child" button. Examples: Fields (N TKModelField), Rules (N TKRule), DetailReferences (N TKModelDetailReference).

[YamlContainer('Fields', TKModelField, 'Data fields of this model')]
property Fields: TKModelFields read GetFields;
pascal
constructor Create(const ANodePath: string;

Creates the attribute for the container at ANodePath whose children are instances of AChildClass.

pascal
property NodePath: string read FNodePath;

Path to the container node in the YAML tree.

pascal
property ChildClass: TClass read FChildClass;

Delphi class of each child element. KIDE uses this to discover the child's own YAML attributes via RTTI.

pascal
property Description: string read FDescription;

English description shown as tooltip in KIDE.

YamlSubNodeAttribute class

Marks a read-only property as a single sub-object with a fixed set of properties. Unlike YamlContainer, this node has no "Add" button — it is a single config block. KIDE navigates into the SubNodeClass via RTTI to show its properties. Examples: HTMLEditor, PreviewWindow, Thumbnail, MobileSettings.

[YamlSubNode('HTMLEditor', TKHTMLEditorConfig, 'Rich-text editor toolbar options')]
property HTMLEditor: TKHTMLEditorConfig read GetHTMLEditor;
pascal
constructor Create(const ANodePath: string;

Creates the attribute for the single sub-object at ANodePath, described by ASubNodeClass.

pascal
property NodePath: string read FNodePath;

Path to the sub-object node in the YAML tree.

pascal
property SubNodeClass: TClass read FSubNodeClass;

Delphi class representing the sub-object. KIDE discovers its YAML-mapped properties via RTTI.

pascal
property Description: string read FDescription;

English description shown as tooltip in KIDE.

YamlEnumValueAttribute class

Maps an enumerated type's ordinal value to its YAML string representation. Applied to the enum type itself, not to individual properties. KIDE reads these to populate combo box drop-downs.

type
[YamlEnumValue('Top', 'Label above the field')]
[YamlEnumValue('Left', 'Label to the left, left-aligned')]
[YamlEnumValue('Right', 'Label to the left, right-aligned')]
TKLabelAlign = (laTop, laLeft, laRight);
pascal
constructor Create(const AYamlValue: string;

Creates the attribute mapping the enum ordinal it decorates to the YAML string AYamlValue.

pascal
property YamlValue: string read FYamlValue;

The string value as written in the YAML file (e.g. 'Top', 'Left', 'Right').

pascal
property Description: string read FDescription;

English description shown in KIDE combo box and tooltips.

YamlChildTypeAttribute class

Declares a child type that can be added to a container class. Applied to container classes (TKModelFields, TKRules, etc.) to list the types of children that KIDE should offer in the "Add" popup menu. Multiple attributes can be applied to the same class.

[YamlChildType('StringField', 'String(10)', 'String field with max length')]
[YamlChildType('IntegerField', 'Integer', 'Integer numeric field')]
TKModelFields = class(TKMetadataItem)
pascal
constructor Create(const AName: string;

Creates the attribute declaring an addable child named AName, with an optional default value and description. Use this form for scalar/marker children (e.g. 'StringField' -> 'String(10)').

pascal
constructor Create(const AName: string;

Creates the attribute binding an addable child named AName to a descriptor class AChildClass. Use this form for heterogeneous config children whose per-type shape KIDE should edit (e.g. 'Field' -> TKLayoutFieldConfig, 'FreeSearch' -> TKFilterItemFreeSearch). KIDE resolves the node to AChildClass via GetSubNodeClassFromParent and renders its property editor.

pascal
property Name: string read FName;

Node name for the child (e.g. 'StringField', 'ForceUpperCase').

pascal
property ChildClass: TClass read FChildClass;

Descriptor class for the child node, or nil for scalar/marker children. When assigned, KIDE renders this class's [YamlNode]/[YamlSubNode] editor for the added child.

pascal
property DefaultValue: string read FDefaultValue;

Default value for the child node (e.g. 'String(10)', 'Integer'). Empty string if no default value.

pascal
property Description: string read FDescription;

English description shown as tooltip in KIDE.

Released under Apache License, Version 2.0.