From 60f150ec0746ba92e7d466bcd0e82d969fb19166 Mon Sep 17 00:00:00 2001 From: Ommar Nadeem Date: Fri, 14 Aug 2026 21:17:36 +0500 Subject: [PATCH 1/2] feat: add italic font style schemas --- schemas/richcaptionproperties.yaml | 8 ++++++++ schemas/richtextproperties.yaml | 8 ++++++++ tests/smoke.cjs | 24 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/schemas/richcaptionproperties.yaml b/schemas/richcaptionproperties.yaml index 4122efd..0a5a7d7 100644 --- a/schemas/richcaptionproperties.yaml +++ b/schemas/richcaptionproperties.yaml @@ -132,6 +132,14 @@ RichCaptionFont: The weight of the font. Can be a number (100-900) or a string ('normal', 'bold', etc.). 100 is lightest, 900 is heaviest (boldest). default: "400" + style: + description: The font style. + type: string + enum: + - normal + - italic + default: "normal" + example: "italic" color: description: The text color using hexadecimal color notation. type: string diff --git a/schemas/richtextproperties.yaml b/schemas/richtextproperties.yaml index caa8773..8562f5d 100644 --- a/schemas/richtextproperties.yaml +++ b/schemas/richtextproperties.yaml @@ -19,6 +19,14 @@ RichTextFont: The weight of the font. Can be a number (100-900) or a string ('normal', 'bold', etc.). 100 is lightest, 900 is heaviest (boldest). default: "400" + style: + description: The font style. + type: string + enum: + - normal + - italic + default: "normal" + example: "italic" color: description: The text color using hexadecimal color notation. type: string diff --git a/tests/smoke.cjs b/tests/smoke.cjs index 118a02c..4048e47 100644 --- a/tests/smoke.cjs +++ b/tests/smoke.cjs @@ -109,9 +109,11 @@ async function run() { const result = zodCjs.richTextAssetSchema.parse({ type: "rich-text", text: "Hello world", + font: { style: "italic" }, }); assert.strictEqual(result.type, "rich-text"); assert.strictEqual(result.text, "Hello world"); + assert.strictEqual(result.font.style, "italic"); }); check("Reject invalid rich-text asset (missing text)", () => { @@ -120,6 +122,16 @@ async function run() { }); }); + check("Reject unsupported rich-text font style", () => { + assert.throws(() => { + zodCjs.richTextAssetSchema.parse({ + type: "rich-text", + text: "Hello world", + font: { style: "oblique" }, + }); + }); + }); + check("Parse valid svg asset", () => { const result = zodCjs.svgAssetSchema.parse({ type: "svg", @@ -138,8 +150,10 @@ async function run() { const result = zodCjs.richCaptionAssetSchema.parse({ type: "rich-caption", src: "https://example.com/captions.srt", + font: { style: "italic" }, }); assert.strictEqual(result.type, "rich-caption"); + assert.strictEqual(result.font.style, "italic"); }); check("Reject invalid rich-caption asset (wrong type value)", () => { @@ -148,6 +162,16 @@ async function run() { }); }); + check("Reject unsupported rich-caption font style", () => { + assert.throws(() => { + zodCjs.richCaptionAssetSchema.parse({ + type: "rich-caption", + src: "https://example.com/captions.srt", + font: { style: "oblique" }, + }); + }); + }); + console.log("\n--- Unified asset schema: existing shape (regression guard) ---\n"); check("Parse imageAsset with src only (existing shape)", () => { From 18a151a29c0ca5af0afe67363f03041841a704d5 Mon Sep 17 00:00:00 2001 From: Ommar Nadeem Date: Sat, 15 Aug 2026 00:06:54 +0500 Subject: [PATCH 2/2] no-mistakes(review): restore minimal-shape parse checks, add separate italic cases --- tests/smoke.cjs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tests/smoke.cjs b/tests/smoke.cjs index 4048e47..160c823 100644 --- a/tests/smoke.cjs +++ b/tests/smoke.cjs @@ -109,11 +109,9 @@ async function run() { const result = zodCjs.richTextAssetSchema.parse({ type: "rich-text", text: "Hello world", - font: { style: "italic" }, }); assert.strictEqual(result.type, "rich-text"); assert.strictEqual(result.text, "Hello world"); - assert.strictEqual(result.font.style, "italic"); }); check("Reject invalid rich-text asset (missing text)", () => { @@ -122,6 +120,15 @@ async function run() { }); }); + check("Parse rich-text font style italic", () => { + const result = zodCjs.richTextAssetSchema.parse({ + type: "rich-text", + text: "Hello world", + font: { style: "italic" }, + }); + assert.strictEqual(result.font.style, "italic"); + }); + check("Reject unsupported rich-text font style", () => { assert.throws(() => { zodCjs.richTextAssetSchema.parse({ @@ -150,10 +157,8 @@ async function run() { const result = zodCjs.richCaptionAssetSchema.parse({ type: "rich-caption", src: "https://example.com/captions.srt", - font: { style: "italic" }, }); assert.strictEqual(result.type, "rich-caption"); - assert.strictEqual(result.font.style, "italic"); }); check("Reject invalid rich-caption asset (wrong type value)", () => { @@ -162,6 +167,15 @@ async function run() { }); }); + check("Parse rich-caption font style italic", () => { + const result = zodCjs.richCaptionAssetSchema.parse({ + type: "rich-caption", + src: "https://example.com/captions.srt", + font: { style: "italic" }, + }); + assert.strictEqual(result.font.style, "italic"); + }); + check("Reject unsupported rich-caption font style", () => { assert.throws(() => { zodCjs.richCaptionAssetSchema.parse({