Reference Manual
Lookup tables for everything a definition file can contain.
For prose and examples see the preceding chapters; this page is for checking a key name, a pattern, or a rule quickly.
The authoritative machine readable form is the definition meta-schema, written by cfu def generate --schema-output.
Document Structure
Top level keys of a .def.json5 file:
| Key | Required | Meaning |
|---|---|---|
|
yes |
Version of the definition language, currently |
|
yes |
Name and root type of the definition.
UpperCamelCase.
Configurations bind to it via |
|
yes |
Version of the model, |
|
with |
|
|
recommended |
Documentation of the definition. Description renders Markdown. A missing one is reported as an info diagnostic, since both reach the configuration author. |
|
no |
The root children. Every direct child must be an entity element. |
|
no |
Reusable types.
Each entry needs a |
|
no |
Rules of the definition root, run once over the whole configuration, see Constraints. |
|
no |
Custom annotation type declarations. |
|
no |
Workspace wide mode and file type policy. At most one definition per workspace may set it. |
Element Keys
Common keys available on every element (relation):
| Key | Meaning |
|---|---|
|
Short descriptive name, shown in hover and completion. |
|
Long documentation, Markdown.
Multiline text is indent-normalized: the common leading indentation and a single leading/trailing blank line are removed, so the text can be indented to match the JSON nesting.
JSON5 has no raw multiline strings, so end each line with |
|
Note for readers of the definition file, ignored by tooling. |
|
|
|
Same grammar as |
|
|
|
Explicit type name, UpperCamelCase. Required for a list property. For a single element it defaults to the capitalized property name. |
|
Type path of the parent entity. Entities only. |
|
Derives the entity name from one of its own parameters.
Use it when the real identity is a value the author writes anyway, such as a fully qualified name.
Names an own or inherited |
|
Derives the globally unique |
|
Free text hint about the embedded type, documentation only.
Use sparingly, only when the embedded side uses a better-fitting type than the configuration type, for example |
|
Suppresses the singular/plural name check. |
|
Rules relating several values, each with |
|
Custom annotation value, see Annotations. |
|
Built-in deprecation annotation, see Deprecating Elements. |
Plus exactly one type keyword:
| Keyword | Options | Notes |
|---|---|---|
|
children as nested relations |
Has |
|
children as nested relations |
No identity. No entities among children. |
|
|
Members are type paths of entities or structs.
Discriminated via |
|
type path string |
Element takes the shape of the referenced type. |
|
|
Reference to an entity of one of the listed type paths. |
|
|
|
|
|
|
|
|
|
|
|
Literal lists are mutually exclusive; literals must match |
|
|
Literals are SCREAMING_SNAKE_CASE identifiers, unique ignoring case (see Naming rules). |
|
|
Values checked as C identifiers. |
|
|
Values resolved and checked on disk, see File Path. |
|
|
Value is a type path of the definition, restricted to the listed element kinds. Only allowed inside an annotation type declaration. |
Naming Rules
| Item | Pattern | Additional rules |
|---|---|---|
Property name |
|
Not |
Type name / |
|
Unique type path per workspace definition set.
Simple names must not clash for generated code.
A list entity or struct, or a plural-named list, must set |
Type path |
|
Segments joined with |
Enum literal |
|
Unique within the enum, ignoring case.
Any other identifier matching |
Entity |
|
|
Reference path (config side) |
|
Path segments are entity identities starting at the definition name. |
Annotation key |
|
Derived from the annotation |
Configuration Side Keywords
For completeness, the special keys a definition author must know when reading configuration files:
| Key | Meaning |
|---|---|
|
Definition name the file binds to, followed by |
|
The long form of the version, as a separate key. Still supported, but giving the version both ways at once is an error. |
|
Priority file type, only in the priority merge mode.
Defaults to |
|
Union discriminator, a type path.
On a fragment root and in a |
|
Absolute entity path of a fragment’s anchor, with |
|
Top level list of mixin declarations, only in the mergeable modes.
Each entry takes a |
|
One mixin name or a list of them, on an entity, a struct, or a |
|
Entity identity. |
|
Documentation and ignored note, on any entity or as reference object members.
|
|
Reference target inside the object form of a reference value. |
File Modes and Priorities
See Multi-file configurations for semantics.
Priority order of $fileType, lowest first:
DefaultValues, DefaultValuesProject, GeneratedBelowUserConfig, UserConfigPriorityLow, UserConfig, UserConfigPriorityHigh, GeneratedAboveUserConfig,
PreConfigurationProject, PreConfiguration, UserOverride, PreConfigurationNoOverride.
File suffix constraints: DefaultValues* types require .default.def.json5, PreConfiguration* types require .preconfig.def.json5, all other types use
.cfg.json5/.cfg.json.
globalSettings
| Key | Meaning |
|---|---|
|
Allowed |
|
Allowed |
|
Reference forms configurations may write. |
|
Severity of a reference to a missing target: |
.confu Keys
| Key | Default | Meaning |
|---|---|---|
|
|
Marks the folder as workspace root. |
|
|
Folder forms its own CfgSpace.
Exclusive with |
|
|
Discovery does not descend below this folder.
May be combined with |
|
none |
Relative paths of additional definition folders or files to load. |
|
|
Enables formatter support for the folder. |
Annotation Retention
Values for retention in an annotation type declaration: Output (the default) keeps the annotation in the sources and in the outputs generated from them, Source limits it to
the definition and configuration files and drops it from the merged JSON output.
Annotation Targets
Values for targets in an annotation type declaration.
All covers everything; AllDef/AllCfg cover one side; the specific values select an element kind on the definition (…Def) or configuration (…Cfg) side:
Document, Entity, Struct, Parameter, String, LinkerSymbol, FilePath, Integer, Float, Enum, Ref, each with the Def or Cfg suffix, plus AnnotationDef for annotating
annotation type declarations and TypeSymbolRefDef for typeSymbolRef elements.
The same values restrict a typeSymbolRef, where only the definition side ones are allowed.
Validation Rule Summary
The checks cfu def validate runs on a definition, grouped:
- Structure
-
Required header keys present and well formed;
configurationFileModepresent whendefinitionis;typesentries carrytypeName; annotation types carrytargets. - Naming
-
All patterns from Naming rules; duplicate type paths, duplicate enum literals, duplicate union members, duplicate annotation names.
- Types and references
-
typeRef,inherits, union members, andrefTargetTypesresolve to existing, visible types of the right kind; no reference or inheritance cycles; unions do not directly contain unions. - Values
-
min ⇐ maxand inside the type range,minLength ⇐ maxLength.defaultwithin range, matching pattern, length, and literals. Regex patterns compile. - Modes
-
globalSettingsandconfigurationFileModenot combined; declared modes and file types consistent withglobalSettings.fileMultiplicityonly on a top-level relation of aMultipleFilesdefinition, its maximum within the one ofmultiplicity, and not without effect.