You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -604,6 +604,7 @@ Notes:
604
604
- JSON uses top-level `width`, `height`, and `layers`
605
605
- Named custom layers added with `canvas.custom(fn, name="...", kwargs={...})` are JSON-serializable via the registry; unnamed custom layers are not
606
606
- Enum-like values such as `blend_mode`, `fit`, and `align` can be passed as strings
607
+
-`quickthumb schema` emits the current JSON Schema for constrained generation and editor autocomplete
607
608
608
609
## AI-Friendly Workflows
609
610
@@ -626,6 +627,8 @@ Use one background image layer, one dark overlay background layer, two text laye
626
627
Only use valid quickthumb layer types and effect names.
627
628
```
628
629
630
+
For constrained generation, first run `quickthumb schema > quickthumb.schema.json` and pass that schema to the model or editor. Prefer concrete field values in schema-constrained calls; `$theme.*` tokens are resolved by quickthumb before model validation and may not satisfy generic JSON Schema validators by themselves.
631
+
629
632
Recommended workflow:
630
633
631
634
1. Have the model produce quickthumb Python or JSON.
Copy file name to clipboardExpand all lines: docs/json-schema.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,36 @@ A quickthumb JSON document has three required top-level fields, plus an optional
39
39
40
40
Every layer object requires a `"type"` discriminator field. Layers render in array order — first item is backmost.
41
41
42
+
## Published schema
43
+
44
+
Emit the current JSON Schema from the same Pydantic models used by `Canvas.from_json()`:
45
+
46
+
```bash
47
+
quickthumb schema > quickthumb.schema.json
48
+
quickthumb schema --output quickthumb.schema.json
49
+
```
50
+
51
+
!!! note "Schema scope"
52
+
`quickthumb schema` describes concrete quickthumb specs for external tooling
53
+
and constrained generation. `Canvas.from_json()` remains the source of truth
54
+
for what quickthumb can load.
55
+
56
+
Authoring conveniences such as `$theme.*` are resolved by quickthumb before
57
+
model validation, so generic JSON Schema validators may reject unresolved
58
+
authoring specs that quickthumb itself can load.
59
+
60
+
The command writes deterministic JSON only, so it can be checked into a repo, piped into an editor, or passed directly to a constrained-generation API. The schema includes the current canvas fields, built-in layer discriminators, effects, animations, supported platform presets, and the optional top-level `theme` block.
61
+
62
+
For constrained generation, prefer concrete resolved values in typed fields:
63
+
64
+
```text
65
+
Use quickthumb.schema.json as the JSON response schema.
66
+
Generate one valid quickthumb canvas spec for a 1280x720 YouTube thumbnail.
67
+
Return only the JSON object.
68
+
Use concrete hex colors and numeric sizes in layer fields.
69
+
Use only these layer type discriminators: background, text, image, shape, svg, group, outline.
70
+
```
71
+
42
72
## Theme tokens
43
73
44
74
Define brand tokens once in a top-level `theme` block and reference them anywhere in the spec with `$theme.path`:
0 commit comments