Skip to content

Generation Attributes

Declares the expected CCL version for a source file.

#[CCLVersion("1.0.0")]

Groups generated output files.

#[OutputFileGroup("shared")]
#namespace:[$go:OutputFileGroup("api")]
[OutputFileGroup("positions")]
model PositionInfo {
X: int64;
}

The group value must be a non-empty string when used and may contain only letters, digits, and underscores.

The Go generator currently uses this to route model artifacts into grouped files such as types_positions.go and methods_positions.go. Go enum member constants also follow the enum output file group, but generated ModelId* constants are an exception: they always go into constants.go because they are internal CCL metadata.

Controls generated per-model filenames where the target generator supports per-model files.

#[FileNamingStyle("snake_case")]

Supported style names are:

  • PascalCase
  • camelCase
  • snake_case
  • kebab-case

Python and GDScript currently support PascalCase, camelCase, and snake_case, with snake_case as the default.

Requests single-file output for generators that support it.

#[GenerateSingleFile(true, "models.ts")]

Currently used by JavaScript, TypeScript, and C#.

Controls model ID constants and accessor methods for all models, including imported models.

#[GenerateModelIds(false)]

Requires exactly one boolean: false omits both constants and accessors; true enables them and is the default.

Only global scope (#[...] or #global:[...]) is allowed. Model IDs cannot be enabled or disabled for individual files, namespaces, or models.

Supported by Go, C#, GDScript, JavaScript, TypeScript, and Python.

Requests generated clone helpers for supported targets.

#[AddCloneMethods(true)]

Go currently supports this by adding CloneEmpty methods.

Adds a raw target-language annotation line above a generated model class.

[AddAnnotation("@stuff")]
[AddAnnotation("@stuff2")]
[AddAnnotation("@stuff(23)")]
model UserInfo {
Id: string;
}

Multiple AddAnnotation attributes can be placed on the same model. CCL copies the first parameter exactly as the generated annotation line and does not validate the target-language annotation syntax.

GDScript currently consumes this attribute.

Requests extra Go clone output that returns the generated Serializable interface.

#[$go:AddSerializableInterface]

This is a Go-specific generation attribute.

Sets the namespace for generated C# code.

#[$cs:CSharpNamespace("My.Project.Contracts")]

If it is not set, the C# generator uses its namespace fallback behavior.