Architecture decision record · ADR-0015
How codegen classifies a contract type
The classifier uses these rules in this order:
Context
A contract does not say if an object is an entity, a shape or a value. The generator must decide, and the app must be able to see and change the decision.
Decision drivers
Not recorded in the original ADR.
Options considered
Not recorded in the original ADR.
Decision
The classifier uses these rules in this order:
- An explicit mark wins:
x-millwork: entity | shape | valuein OpenAPI, a@millwork(kind: ...)directive in GraphQL, or theclassifymap in the config. - Entity: a JSON:API resource object, a GraphQL object type with
id: ID!, or an OpenAPI object with anidproperty that an operation gives at the top level of a response (also inside an array or adataproperty). - Value: every property is
readOnly. - Shape: every other object.
- An inline object gets the name of its parent plus the property name, in PascalCase. A
titleorx-millwork-namereplaces it. - Two types with the same structure and different names stay two types.
millwork-codegen explainprints the rule and the source of each decision.
Consequences
- The default is a shape, because a form can edit a shape. A wrong default costs little.
- An app with an unusual API uses marks or the config, not changes to the generated files.
Confirmation
Not recorded in the original ADR.
Interview record
Each question of the interview with its answer and its source. A fact from the code or a document, a question that the author did not ask, and an assumption are rows too.
| Question | Answer | Source |
|---|---|---|
| Where does the text of this page come from? | From the Markdown file docs/adr/0015-codegen-classification.md at commit c8154b0. The text of each section is the text of the Markdown file. A section that the Markdown file does not have says so. | Document: docs/adr/0015-codegen-classification.md |
Changelog
| Date | Author | Change |
|---|---|---|
| 2026-12-03 | Joe Gaudet | Status in the Markdown file: Accepted (codegen C0). |
| 2026-12-03 | Joe Gaudet | Commit 7b66d71: Add codegen: one contract gives WarpDrive, Millwork, real-enums, Formwright and harnessed code (#7) |
| 2026-12-04 | Joe Gaudet (agent) | Converted from docs/adr/0015-codegen-classification.md to this page. The text is the text of the Markdown file. |
The adr skill of skillsaw wrote this page. The HTML in this file is the source of truth. The diagrams are the Mermaid sources in it.