Back to tool

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

  1. Set the model title, machine name, and description.
  2. Add fields — each with a property name, label, and data type.
  3. Mark fields required and/or multiple as needed.
  4. 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 textString
  • NumberInt
  • BooleanBoolean
  • Date and timeCalendar
  • Enumeration (dropdown)String (provide comma-separated options)
  • Tags[String]
  • Content reference (asset)String
  • Fragment reference → a nested type (provide the referenced model path)
  • JSON objectString

Mark a field multiple to make it a list (valueType[]).

Outputs

  • Model XML — the .content.xml for /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, including html/plaintext for text and _path for 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

  1. Go to Tools → Assets → Content Fragment Models.
  2. Select your configuration folder and click Create.
  3. Name the model and add the fields with the matching data types.
  4. 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.