AEM Content Fragment Model Generator — User Guide
This tool turns a simple field form into an AEM Content Fragment Model plus everything you need around it: a model .content.xml, a sample GraphQL query, a JSON spec, and authoring docs. It's a companion to the AEM Component Generator. Everything runs in your browser.
Quick start
- Set the model title, machine name, and description.
- Add fields — each with a property name, label, and data type.
- Mark fields required and/or multiple as needed.
- Switch the output tab between Model XML, GraphQL, JSON, and Docs, then Copy or Download.
Field data types
Each type maps to an AEM CFM data type and a GraphQL type:
- Single line text, Multi line text, Rich text →
String - Number →
Int - Boolean →
Boolean - Date and time →
Calendar - Enumeration (dropdown) →
String(provide comma-separated options) - Tags →
[String] - Content reference (asset) →
String - Fragment reference → a nested type (provide the referenced model path)
- JSON object →
String
Mark a field multiple to make it a list (valueType[]).
Outputs
- Model XML — the
.content.xmlfor/conf/<project>/settings/dam/cfm/models/<name>. Place it at that path (or recreate the model in the AEM Models UI). - GraphQL — a sample list query (
<model>List) and a single-fragment query (<model>ByPath) with the right field selections, includinghtml/plaintextfor text and_pathfor references. - JSON — a compact, documented spec of the model and its fields — handy for sharing or version control.
- Docs — Markdown authoring documentation: a field table plus step-by-step instructions to create the model and author a fragment.
Creating the model in AEM
- Go to Tools → Assets → Content Fragment Models.
- Select your configuration folder and click Create.
- Name the model and add the fields with the matching data types.
- Enable the model so authors can use it.
Querying with GraphQL
Run the generated query against your project's GraphQL endpoint, or save it as a persisted query for production — persisted queries are cacheable through the Dispatcher and avoid exposing the full query surface.
Caveats
The internal .content.xml format varies across AEM versions; treat the generated XML as a strong starting point and verify against your environment. Many teams create models through the UI and use this tool mainly for the GraphQL, JSON spec, and docs.