Skip to content

Commit b703adf

Browse files
committed
refactor(docs): drop dead referencedFields, fix trailing-space in template page, add byte-exact goldens
1 parent 40c39a3 commit b703adf

8 files changed

Lines changed: 99 additions & 11 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!-- @generated by @metaobjectsdev/codegen-ts — DO NOT EDIT. -->
2+
3+
# Welcome
4+
5+
**Type:** `object.value`
6+
**Source:** `meta.json`
7+
8+
## Constraints
9+
10+
| Field | Required | Type | Limits | Rules |
11+
|---|---|---|---|---|
12+
| `name` | | `string` | | |
13+
| `headline` | | `string` | | |
14+
15+
## Used by
16+
17+
- [`template.output WelcomePage`](./WelcomePage.md) — uses `Welcome` as `@payloadRef`
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!-- @generated by @metaobjectsdev/codegen-ts — DO NOT EDIT. -->
2+
3+
# WelcomePage
4+
5+
**Kind:** document
6+
7+
## Output
8+
9+
- Format: `html`
10+
11+
## Input
12+
13+
- Payload: [`Welcome`](./Welcome.md)
14+
- Required fields: `section`
15+
16+
## Render contract
17+
18+
- Every field referenced by the template is validated against the payload at generation time; an unknown field fails generation.
19+
- Maximum length: 5000 characters (rendering longer output fails).
20+
- Required tags must be present: `section`
21+
22+
## Source
23+
24+
- `site/welcome`
25+
26+
## Capability
27+
28+
A render helper is generated for this template: it takes the payload and returns the rendered output as a single string.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!-- @generated by @metaobjectsdev/codegen-ts — DO NOT EDIT. -->
2+
3+
# Welcome
4+
5+
**Type:** `object.value`
6+
**Source:** `meta.json`
7+
8+
## Constraints
9+
10+
| Field | Required | Type | Limits | Rules |
11+
|---|---|---|---|---|
12+
| `name` | | `string` | | |
13+
| `headline` | | `string` | | |
14+
15+
## Used by
16+
17+
- [`template.output WelcomeEmail`](./WelcomeEmail.md) — uses `Welcome` as `@payloadRef`
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!-- @generated by @metaobjectsdev/codegen-ts — DO NOT EDIT. -->
2+
3+
# WelcomeEmail
4+
5+
**Kind:** email
6+
7+
## Output
8+
9+
Multipart email — rendered as the following parts:
10+
11+
| Part | Source | Format | Escaping |
12+
|---|---|---|---|
13+
| Subject | `email/welcome.subject` | `text` | raw |
14+
| HTML body | `email/welcome.html` | `html` | escaped |
15+
| Text body | `email/welcome.text` | `text` | raw |
16+
17+
## Input
18+
19+
- Payload: [`Welcome`](./Welcome.md)
20+
21+
## Render contract
22+
23+
- Every field referenced by the template is validated against the payload at generation time; an unknown field fails generation.
24+
25+
## Source
26+
27+
- `email/welcome.subject`
28+
- `email/welcome.html`
29+
- `email/welcome.text`
30+
31+
## Capability
32+
33+
A render helper is generated for this template: it takes the payload and returns the rendered email — subject, HTML body, and an optional text body.

server/typescript/packages/codegen-ts/src/generators/template-doc-builder.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ export function buildTemplateDocData(template: MetaData): TemplateDocData {
111111
isEmail,
112112
format,
113113
payload: { name: payloadName, link: `./${payloadName}.md` },
114-
referencedFields: requiredTags,
115114
sourceRefs,
116115
capability: isEmail ? CAPABILITY_EMAIL : CAPABILITY_DOCUMENT,
117116
};

server/typescript/packages/codegen-ts/src/generators/template-doc-data.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ export interface TemplateDocData {
5353
* entity-page filename + the entity's Used-by back-link). */
5454
payload: { name: string; link: string };
5555

56-
/** Best-effort list of fields the template references. Sourced from
57-
* @requiredTags (the only declared field-level contract on a template.output
58-
* node); the full mustache-referenced field set is a build-time drift gate,
59-
* not declared metadata. Empty when none. */
60-
referencedFields: string[];
61-
6256
/** @requiredTags, if declared. Drives both the Input "Required fields" line
6357
* and the Render-contract "Required tags" bullet. */
6458
requiredTags?: string[];

server/typescript/packages/codegen-ts/templates/docs/template-page.md.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Multipart email — rendered as the following parts:
2828

2929
- Payload: [`{{payload.name}}`]({{payload.link}})
3030
{{#hasRequiredTags}}
31-
- Required fields: {{#requiredTags}}`{{.}}` {{/requiredTags}}
31+
- Required fields:{{#requiredTags}} `{{.}}`{{/requiredTags}}
3232
{{/hasRequiredTags}}
3333

3434
## Render contract
@@ -38,7 +38,7 @@ Multipart email — rendered as the following parts:
3838
- Maximum length: {{.}} characters (rendering longer output fails).
3939
{{/maxChars}}
4040
{{#hasRequiredTags}}
41-
- Required tags must be present: {{#requiredTags}}`{{.}}` {{/requiredTags}}
41+
- Required tags must be present:{{#requiredTags}} `{{.}}`{{/requiredTags}}
4242
{{/hasRequiredTags}}
4343

4444
## Source

templates/docs/template-page.md.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Multipart email — rendered as the following parts:
2828

2929
- Payload: [`{{payload.name}}`]({{payload.link}})
3030
{{#hasRequiredTags}}
31-
- Required fields: {{#requiredTags}}`{{.}}` {{/requiredTags}}
31+
- Required fields:{{#requiredTags}} `{{.}}`{{/requiredTags}}
3232
{{/hasRequiredTags}}
3333

3434
## Render contract
@@ -38,7 +38,7 @@ Multipart email — rendered as the following parts:
3838
- Maximum length: {{.}} characters (rendering longer output fails).
3939
{{/maxChars}}
4040
{{#hasRequiredTags}}
41-
- Required tags must be present: {{#requiredTags}}`{{.}}` {{/requiredTags}}
41+
- Required tags must be present:{{#requiredTags}} `{{.}}`{{/requiredTags}}
4242
{{/hasRequiredTags}}
4343

4444
## Source

0 commit comments

Comments
 (0)