From 5efe25ef4666692dff3f18ab02f0a02145605a78 Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Tue, 19 Aug 2025 11:06:47 +1000 Subject: [PATCH 01/16] Upgrades Zod major version to 4 * Updates Zod dependency version * Increments package major version, to account for breaking change (Zod Major version 3 no longer supported) * Adds missing type dependency for node --- package-lock.json | 30 ++++++++++++++++++++++++------ package.json | 5 +++-- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9712ea7..2e93081 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,18 @@ { "name": "zod-from-json-schema", - "version": "0.4.1", + "version": "0.4.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "zod-from-json-schema", - "version": "0.4.1", + "version": "0.4.2", "license": "MIT", "dependencies": { - "zod": "^3.25.25" + "zod": "^4.0.17" }, "devDependencies": { + "@types/node": "^24.3.0", "@vitest/coverage-v8": "^3.0.9", "esbuild": "^0.25.2", "typescript": "^5.8.3", @@ -896,6 +897,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/node": { + "version": "24.3.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.0.tgz", + "integrity": "sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.10.0" + } + }, "node_modules/@vitest/coverage-v8": { "version": "3.0.9", "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-3.0.9.tgz", @@ -1976,6 +1987,13 @@ "node": ">=14.17" } }, + "node_modules/undici-types": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz", + "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==", + "dev": true, + "license": "MIT" + }, "node_modules/vite": { "version": "6.3.5", "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz", @@ -2275,9 +2293,9 @@ } }, "node_modules/zod": { - "version": "3.25.25", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.25.tgz", - "integrity": "sha512-ZIe8jLjydG09F/5joIm10fSKa3pQ64YS1OfhQzNVwbHEd0MeAF3A9CbcKl5/1Pr6Wr37TMJtEWki8X2Y/2MvGQ==", + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.0.17.tgz", + "integrity": "sha512-1PHjlYRevNxxdy2JZ8JcNAw7rX8V9P1AKkP+x/xZfxB0K5FYfuV+Ug6P/6NVSR2jHQ+FzDDoDHS04nYUsOIyLQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/package.json b/package.json index d0adbbf..6cc1cd5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zod-from-json-schema", - "version": "0.4.2", + "version": "1.0.0", "description": "Creates Zod types from JSON Schema at runtime", "main": "dist/index.js", "module": "dist/index.mjs", @@ -29,9 +29,10 @@ "url": "git+https://github.com/glideapps/zod-from-json-schema.git" }, "dependencies": { - "zod": "^3.25.25" + "zod": "^4.0.17" }, "devDependencies": { + "@types/node": "^24.3.0", "@vitest/coverage-v8": "^3.0.9", "esbuild": "^0.25.2", "typescript": "^5.8.3", From bb72a32aa486da5ddda0d4f8b940a67ba89a2397 Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Tue, 19 Aug 2025 11:07:47 +1000 Subject: [PATCH 02/16] Updates handler to explicitly check for attribute value --- src/handlers/primitive/number.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/handlers/primitive/number.ts b/src/handlers/primitive/number.ts index 1512384..77a57c8 100644 --- a/src/handlers/primitive/number.ts +++ b/src/handlers/primitive/number.ts @@ -38,7 +38,11 @@ export class ExclusiveMinimumHandler implements PrimitiveHandler { if (types.number !== false) { const currentNumber = types.number || z.number(); if (currentNumber instanceof z.ZodNumber) { - types.number = currentNumber.gt(numberSchema.exclusiveMinimum); + if (typeof numberSchema.exclusiveMinimum === "number") { + types.number = currentNumber.gt(numberSchema.exclusiveMinimum); + } else { + types.number = false; + } } } } @@ -52,7 +56,11 @@ export class ExclusiveMaximumHandler implements PrimitiveHandler { if (types.number !== false) { const currentNumber = types.number || z.number(); if (currentNumber instanceof z.ZodNumber) { - types.number = currentNumber.lt(numberSchema.exclusiveMaximum); + if (typeof numberSchema.exclusiveMaximum === "number") { + types.number = currentNumber.lt(numberSchema.exclusiveMaximum); + } else { + types.number = false; + } } } } From 7266e69ad7a99334e6704eb13a64db4ac5f8ed06 Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Tue, 19 Aug 2025 11:09:25 +1000 Subject: [PATCH 03/16] Updates type references to refer to Zod directly --- src/examples.test.ts | 5 +- src/index.test.ts | 138 +++++++++++++++++++++++-------------------- src/index.ts | 33 ++++++++++- 3 files changed, 107 insertions(+), 69 deletions(-) diff --git a/src/examples.test.ts b/src/examples.test.ts index 0fcb58d..cae722f 100644 --- a/src/examples.test.ts +++ b/src/examples.test.ts @@ -1,6 +1,7 @@ import { describe, it, expect } from "vitest"; -import { convertJsonSchemaToZod, JSONSchema } from "./index"; +import { convertJsonSchemaToZod } from "./index"; import { z } from "zod/v4"; +import type { JSONSchema } from "zod/v4/core"; import examples from "./examples.json"; // Helper function to find differences between objects @@ -54,7 +55,7 @@ describe("examples tests", () => { it(`should correctly convert example ${index}`, () => { try { // Convert JSON schema to Zod - const zodSchema = convertJsonSchemaToZod(example); + const zodSchema = convertJsonSchemaToZod(example as unknown as JSONSchema.BaseSchema); // Convert Zod schema back to JSON schema const resultSchema = z.toJSONSchema(zodSchema); diff --git a/src/index.test.ts b/src/index.test.ts index bf2f26d..69b410a 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -1,11 +1,12 @@ import { describe, it, expect } from "vitest"; import { convertJsonSchemaToZod, jsonSchemaObjectToZodRawShape } from "./index"; import { z } from "zod/v4"; +import {JSONSchema} from "zod/v4/core"; describe("convertJsonSchemaToZod", () => { it("should correctly convert a schema with additionalProperties: {}", () => { // Define a simple JSON schema - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "object", properties: { @@ -29,7 +30,7 @@ describe("convertJsonSchemaToZod", () => { it("should correctly convert a schema with additionalProperties: false", () => { // Define a JSON schema with additionalProperties: false - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "object", properties: { @@ -51,7 +52,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should correctly convert a schema with array type", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", items: { @@ -66,7 +67,7 @@ describe("convertJsonSchemaToZod", () => { describe("Enum handling", () => { it("should correctly convert a schema with string enum (no type)", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", enum: ["red", "green", "blue"], }; @@ -79,7 +80,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should correctly convert a schema with number enum (no type)", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", enum: [1, 2, 3], }; @@ -92,11 +93,11 @@ describe("convertJsonSchemaToZod", () => { const resultSchema = z.toJSONSchema(zodSchema); // Zod v4 converts unions to anyOf instead of enum - expect(resultSchema.anyOf).toEqual([{ const: 1 }, { const: 2 }, { const: 3 }]); + expect(resultSchema.anyOf).toEqual([{ type: "number", const: 1 }, { type: "number", const: 2 }, { type: "number", const: 3 }]); }); it("should correctly convert a schema with boolean enum (no type)", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", enum: [true, false], }; @@ -110,11 +111,11 @@ describe("convertJsonSchemaToZod", () => { const resultSchema = z.toJSONSchema(zodSchema); // Zod v4 converts unions to anyOf instead of enum - expect(resultSchema.anyOf).toEqual([{ const: true }, { const: false }]); + expect(resultSchema.anyOf).toEqual([{ type: "boolean", const: true }, { type: "boolean", const: false }]); }); it("should correctly convert a schema with mixed enum (no type)", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", enum: ["red", 1, true, null], }; @@ -131,11 +132,11 @@ describe("convertJsonSchemaToZod", () => { const resultSchema = z.toJSONSchema(zodSchema); // Zod v4 converts unions to anyOf instead of enum - expect(resultSchema.anyOf).toEqual([{ const: "red" }, { const: 1 }, { const: true }, { type: "null" }]); + expect(resultSchema.anyOf).toEqual([{ type: "string", const: "red" }, { type: "number", const: 1 }, { type: "boolean", const: true }, { type: "null" }]); }); it("should correctly convert a schema with single item mixed enum (no type)", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", enum: [42], // Single non-string value }; @@ -153,7 +154,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle empty enum case (no type)", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", enum: [], // Empty enum }; @@ -168,7 +169,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should correctly convert a schema with string type and enum", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "string", enum: ["red", "green", "blue"], @@ -186,7 +187,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle empty string enum (with type)", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "string", enum: [], // Empty enum @@ -202,7 +203,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should correctly convert a schema with number type and enum", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "number", enum: [1, 2, 3], @@ -220,7 +221,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should correctly convert a schema with number type and single-item enum", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "number", enum: [42], @@ -237,7 +238,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should correctly convert a schema with boolean type and single-item enum", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "boolean", enum: [true], @@ -258,7 +259,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should correctly convert a schema with boolean type and multiple-item enum", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "boolean", enum: [true, false], @@ -276,7 +277,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle empty number enum (with type)", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "number", enum: [], // Empty enum @@ -292,7 +293,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle empty boolean enum (with type)", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "boolean", enum: [], // Empty enum @@ -311,7 +312,7 @@ describe("convertJsonSchemaToZod", () => { describe("Const value handling", () => { it("should correctly handle string const values", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", const: "fixed value", }; @@ -326,7 +327,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should correctly handle number const values", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", const: 42, }; @@ -341,7 +342,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should correctly handle boolean const values", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", const: true, }; @@ -356,7 +357,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should correctly handle null const values", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", const: null, }; @@ -414,7 +415,7 @@ describe("convertJsonSchemaToZod", () => { describe("Combination schemas", () => { it("should correctly handle anyOf", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", anyOf: [{ type: "string" }, { type: "number" }], }; @@ -428,7 +429,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should correctly handle allOf", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", allOf: [ { @@ -457,7 +458,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should correctly handle oneOf", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", oneOf: [{ type: "string" }, { type: "number" }], }; @@ -473,7 +474,7 @@ describe("convertJsonSchemaToZod", () => { describe("Edge cases", () => { it("should handle null type schema", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "null", }; @@ -489,7 +490,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle empty object schema with no properties", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "object", }; @@ -498,7 +499,7 @@ describe("convertJsonSchemaToZod", () => { expect(() => zodSchema.parse({})).not.toThrow(); expect(() => zodSchema.parse({ extra: "prop" })).not.toThrow(); // By default additionalProperties is true - + // Arrays should be rejected for explicit object type expect(() => zodSchema.parse([])).toThrow(); @@ -507,7 +508,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle array schema with no items", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", }; @@ -522,7 +523,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should return z.any() for empty schema", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", }; @@ -540,7 +541,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should add description to schema", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "string", description: "A test description", @@ -556,7 +557,7 @@ describe("convertJsonSchemaToZod", () => { // Tests for unimplemented but supported features describe("String validation", () => { it("should support minLength and maxLength constraints", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "string", minLength: 3, @@ -564,16 +565,16 @@ describe("convertJsonSchemaToZod", () => { }; const zodSchema = convertJsonSchemaToZod(jsonSchema); - + // Test that the validation works correctly expect(zodSchema.safeParse("hello").success).toBe(true); // 5 chars, within range expect(zodSchema.safeParse("hi").success).toBe(false); // 2 chars, too short expect(zodSchema.safeParse("this is too long").success).toBe(false); // too long - + // Test Unicode support expect(zodSchema.safeParse("💩💩💩").success).toBe(true); // 3 graphemes expect(zodSchema.safeParse("💩").success).toBe(false); // 1 grapheme, too short - + // Note: length constraints implemented with .refine() don't round-trip // back to JSON Schema, so we only test the validation behavior const resultSchema = z.toJSONSchema(zodSchema); @@ -581,10 +582,9 @@ describe("convertJsonSchemaToZod", () => { }); it("should support pattern constraint", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "string", - format: "regex", pattern: "^[a-zA-Z0-9]+$", }; @@ -596,7 +596,7 @@ describe("convertJsonSchemaToZod", () => { describe("Number validation", () => { it("should support minimum and maximum constraints", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "number", minimum: 0, @@ -609,7 +609,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should support exclusiveMinimum and exclusiveMaximum constraints", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "number", exclusiveMinimum: 0, @@ -622,19 +622,19 @@ describe("convertJsonSchemaToZod", () => { }); it("should support multipleOf constraint", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "number", multipleOf: 5, }; const zodSchema = convertJsonSchemaToZod(jsonSchema); - + // Test that the validation works correctly expect(zodSchema.safeParse(10).success).toBe(true); expect(zodSchema.safeParse(15).success).toBe(true); expect(zodSchema.safeParse(7).success).toBe(false); - + // Note: multipleOf constraints implemented with .refine() don't round-trip // back to JSON Schema, so we only test the validation behavior const resultSchema = z.toJSONSchema(zodSchema); @@ -644,7 +644,7 @@ describe("convertJsonSchemaToZod", () => { describe("Array validation", () => { it("should support minItems and maxItems constraints", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", items: { @@ -660,7 +660,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should support uniqueItems constraint", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", items: { @@ -683,7 +683,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should support uniqueItems constraint with object items", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", items: { @@ -717,7 +717,7 @@ describe("convertJsonSchemaToZod", () => { describe("Tuple arrays (items as array)", () => { it("should handle tuple array with different types", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", items: [{ type: "string" }, { type: "number" }, { type: "boolean" }], @@ -738,7 +738,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle tuple array with single item type", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", items: [{ type: "string" }], @@ -753,7 +753,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle empty tuple array", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", items: [], @@ -766,7 +766,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle tuple array with complex item types", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", items: [ @@ -801,7 +801,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should convert tuple to proper JSON schema", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", items: [{ type: "string" }, { type: "number" }], @@ -818,7 +818,7 @@ describe("convertJsonSchemaToZod", () => { describe("prefixItems (Draft 2020-12 tuples)", () => { it("should handle prefixItems with different types", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", prefixItems: [{ type: "string" }, { type: "number" }, { type: "boolean" }], @@ -843,7 +843,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle prefixItems with single item type", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", prefixItems: [{ type: "string" }], @@ -858,7 +858,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle empty prefixItems array", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", prefixItems: [], @@ -872,7 +872,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle prefixItems with complex nested types", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", prefixItems: [ @@ -926,7 +926,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should validate prefixItems behavior correctly", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", prefixItems: [{ type: "string" }, { type: "number" }], @@ -943,7 +943,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle prefixItems with constraints", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", prefixItems: [ @@ -962,7 +962,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle prefixItems with items: false (strict tuple)", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", prefixItems: [{ type: "string" }, { type: "number" }], @@ -978,7 +978,7 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle prefixItems with items schema (constrained additional items)", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", prefixItems: [{ type: "string" }, { type: "number" }], @@ -1000,17 +1000,19 @@ describe("convertJsonSchemaToZod", () => { describe("jsonSchemaObjectToZodRawShape", () => { it("should extract properties from a JSON schema", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { type: "object", properties: { name: { type: "string" }, age: { type: "integer" }, isActive: { type: "boolean" }, + // @ts-expect-error: invalid schema definition to test behaviour missing: undefined, }, required: ["name", "age"], }; + // @ts-expect-error: invalid schema definition to test behaviour const rawShape = jsonSchemaObjectToZodRawShape(jsonSchema); // Properties should exist in the raw shape @@ -1025,28 +1027,30 @@ describe("jsonSchemaObjectToZodRawShape", () => { }); it("should handle empty properties", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { type: "object", properties: {}, }; + // @ts-expect-error: invalid schema definition to test behaviour const rawShape = jsonSchemaObjectToZodRawShape(jsonSchema); expect(Object.keys(rawShape).length).toBe(0); expect(rawShape).toEqual({}); }); it("should handle missing properties field", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { type: "object", }; + // @ts-expect-error: invalid schema definition to test behaviour const rawShape = jsonSchemaObjectToZodRawShape(jsonSchema); expect(Object.keys(rawShape).length).toBe(0); expect(rawShape).toEqual({}); }); it("should correctly convert nested object properties", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { type: "object", properties: { user: { @@ -1054,6 +1058,7 @@ describe("jsonSchemaObjectToZodRawShape", () => { properties: { name: { type: "string" }, email: { type: "string" }, + // @ts-expect-error: invalid schema definition to test behaviour missing: undefined, }, required: ["name"], @@ -1061,6 +1066,7 @@ describe("jsonSchemaObjectToZodRawShape", () => { }, }; + // @ts-expect-error: invalid schema definition to test behaviour const rawShape = jsonSchemaObjectToZodRawShape(jsonSchema); expect(rawShape).toHaveProperty("user"); @@ -1085,7 +1091,8 @@ describe("jsonSchemaObjectToZodRawShape", () => { }); it("should be usable to build custom schemas", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { + type: "object", properties: { name: { type: "string" }, age: { type: "integer" }, @@ -1093,6 +1100,7 @@ describe("jsonSchemaObjectToZodRawShape", () => { }; // Get the raw shape + // @ts-expect-error: invalid schema definition to test behaviour const rawShape = jsonSchemaObjectToZodRawShape(jsonSchema); // Make fields optional manually and add custom fields diff --git a/src/index.ts b/src/index.ts index b8c1344..f08052a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,13 +8,42 @@ export { convertJsonSchemaToZod }; // Export utilities that tests might depend on export { createUniqueItemsValidator, isValidWithSchema } from "./core/utils"; +// Helper type to infer Zod types from JSON Schema properties +type InferZodTypeFromJsonSchema = + T extends { type: "string" } ? z.ZodString : + T extends { type: "number" } ? z.ZodNumber : + T extends { type: "integer" } ? z.ZodNumber : + T extends { type: "boolean" } ? z.ZodBoolean : + T extends { type: "null" } ? z.ZodNull : + T extends { type: "array" } ? z.ZodArray : + T extends { type: "object" } ? z.ZodObject : + T extends { const: any } ? z.ZodLiteral : + T extends { enum: readonly any[] } ? z.ZodEnum : + z.ZodTypeAny; + +// Helper type to map JSON Schema properties to Zod raw shape +type InferZodRawShape> = { + [K in keyof T]: InferZodTypeFromJsonSchema +}; + +/** + * Converts a JSON Schema object to a Zod raw shape with proper typing + * @param schema The JSON Schema object to convert + * @returns A Zod raw shape for use with z.object() with inferred types + */ +export function jsonSchemaObjectToZodRawShape< + T extends JSONSchema.Schema & { properties: Record } +>(schema: T): InferZodRawShape; + /** * Converts a JSON Schema object to a Zod raw shape * @param schema The JSON Schema object to convert * @returns A Zod raw shape for use with z.object() */ -export function jsonSchemaObjectToZodRawShape(schema: JSONSchema.Schema): z.ZodRawShape { - const raw: Record = {}; +export function jsonSchemaObjectToZodRawShape(schema: JSONSchema.Schema): Record; + +export function jsonSchemaObjectToZodRawShape(schema: JSONSchema.Schema): Record { + const raw: Record = {}; for (const [key, value] of Object.entries(schema.properties ?? {})) { if (value === undefined) continue; From 21d221635da2116e803c5db26808e17777e06a84 Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Tue, 19 Aug 2025 11:10:07 +1000 Subject: [PATCH 04/16] Adds an additional test to ensure test failure is not false negative --- src/index.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.test.ts b/src/index.test.ts index 69b410a..b61bec6 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -1130,5 +1130,8 @@ describe("jsonSchemaObjectToZodRawShape", () => { // Test refinement with invalid age expect(() => customSchema.parse({ age: 16 })).toThrow(); + + // Refinement with correct age, using same format as above test to confirm error was throw for correct reason + expect(() => customSchema.parse({ age: 19 })).not.toThrow(); }); }); From b09ebc5762ebec58eb7917881a5659bac6b85fda Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Tue, 19 Aug 2025 11:10:42 +1000 Subject: [PATCH 05/16] Updates example tests to ensure alignment to schema --- src/examples.json | 1248 ++++++++++++++++++++++++++++++--------------- 1 file changed, 831 insertions(+), 417 deletions(-) diff --git a/src/examples.json b/src/examples.json index 573f84e..b9a876d 100644 --- a/src/examples.json +++ b/src/examples.json @@ -1,1328 +1,1742 @@ [ { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": {}, - "required": [], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "tab": { "type": "string" } }, - "required": ["tab"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "tab" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "table": { "type": "string" } }, - "required": ["table"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "table" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "mode": { - "enum": ["Dashboard", "Data", "Layout", "Workflows", "Settings"] + "type": "string", + "enum": [ + "Dashboard", + "Data", + "Layout", + "Workflows", + "Settings" + ] } }, - "required": ["mode"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "mode" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "filter": { - "type": "string", - "description": "Filter the apps by name or description. Looks for substrings." + "description": "Filter the apps by name or description. Looks for substrings.", + "type": "string" } }, - "required": [], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "ai-custom-chat-component", - "description": "The kind of the component. Must be exactly 'ai-custom-chat-component'" + "description": "The kind of the component. Must be exactly 'ai-custom-chat-component'", + "type": "string", + "const": "ai-custom-chat-component" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "prompt": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "uuid": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "prompt", "uuid"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "prompt", + "uuid" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "hero", - "description": "The kind of the component. Must be exactly 'hero'" + "description": "The kind of the component. Must be exactly 'hero'", + "type": "string", + "const": "hero" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "title": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "titleEmphasized": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "subtitle": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "image": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { + "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "headerImage": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { + "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "title", "titleEmphasized", "subtitle", "image", "headerImage"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "title", + "titleEmphasized", + "subtitle", + "image", + "headerImage" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "fields", - "description": "The kind of the component. Must be exactly 'fields'" + "description": "The kind of the component. Must be exactly 'fields'", + "type": "string", + "const": "fields" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "title": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "title"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "title" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-location", - "description": "The kind of the component. Must be exactly 'page-location'" + "description": "The kind of the component. Must be exactly 'page-location'", + "type": "string", + "const": "page-location" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "value": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "label": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "value", "label"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "value", + "label" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-image", - "description": "The kind of the component. Must be exactly 'page-image'" + "description": "The kind of the component. Must be exactly 'page-image'", + "type": "string", + "const": "page-image" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "title": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "image": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { + "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "caption": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "alt": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "title", "image", "caption", "alt"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "title", + "image", + "caption", + "alt" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-simple-image", - "description": "The kind of the component. Must be exactly 'page-simple-image'" + "description": "The kind of the component. Must be exactly 'page-simple-image'", + "type": "string", + "const": "page-simple-image" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "image": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { + "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "alt": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "image", "alt"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "image", + "alt" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-video", - "description": "The kind of the component. Must be exactly 'page-video'" + "description": "The kind of the component. Must be exactly 'page-video'", + "type": "string", + "const": "page-video" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "title": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "caption": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "title", "caption"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "title", + "caption" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-simple-video", - "description": "The kind of the component. Must be exactly 'page-simple-video'" + "description": "The kind of the component. Must be exactly 'page-simple-video'", + "type": "string", + "const": "page-simple-video" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" } }, - "required": ["kind", "builderDisplayName"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "big-numbers", - "description": "The kind of the component. Must be exactly 'big-numbers'" + "description": "The kind of the component. Must be exactly 'big-numbers'", + "type": "string", + "const": "big-numbers" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "title": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "title"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "title" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-web-view", - "description": "The kind of the component. Must be exactly 'page-web-view'" + "description": "The kind of the component. Must be exactly 'page-web-view'", + "type": "string", + "const": "page-web-view" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" } }, - "required": ["kind", "builderDisplayName"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-progress", - "description": "The kind of the component. Must be exactly 'page-progress'" + "description": "The kind of the component. Must be exactly 'page-progress'", + "type": "string", + "const": "page-progress" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "title": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "description": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "title", "description"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "title", + "description" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-audio", - "description": "The kind of the component. Must be exactly 'page-audio'" + "description": "The kind of the component. Must be exactly 'page-audio'", + "type": "string", + "const": "page-audio" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" } }, - "required": ["kind", "builderDisplayName"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-audio-recorder", - "description": "The kind of the component. Must be exactly 'page-audio-recorder'" + "description": "The kind of the component. Must be exactly 'page-audio-recorder'", + "type": "string", + "const": "page-audio-recorder" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "saveTo": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "title": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "recordText": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "uploadingText": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "saveTo", "title", "recordText", "uploadingText"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "saveTo", + "title", + "recordText", + "uploadingText" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "container", - "description": "The kind of the component. Must be exactly 'container'" + "description": "The kind of the component. Must be exactly 'container'", + "type": "string", + "const": "container" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "backgroundImage": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { + "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "backgroundImage"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "backgroundImage" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-separator", - "description": "The kind of the component. Must be exactly 'page-separator'" + "description": "The kind of the component. Must be exactly 'page-separator'", + "type": "string", + "const": "page-separator" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" } }, - "required": ["kind", "builderDisplayName"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "internal-separator", - "description": "The kind of the component. Must be exactly 'internal-separator'" + "description": "The kind of the component. Must be exactly 'internal-separator'", + "type": "string", + "const": "internal-separator" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" } }, - "required": ["kind", "builderDisplayName"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "text", - "description": "The kind of the component. Must be exactly 'text'" + "description": "The kind of the component. Must be exactly 'text'", + "type": "string", + "const": "text" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "text": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "text"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "text" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-note", - "description": "The kind of the component. Must be exactly 'page-note'" + "description": "The kind of the component. Must be exactly 'page-note'", + "type": "string", + "const": "page-note" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "text": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "label": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "text", "label"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "text", + "label" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-rich-text", - "description": "The kind of the component. Must be exactly 'page-rich-text'" + "description": "The kind of the component. Must be exactly 'page-rich-text'", + "type": "string", + "const": "page-rich-text" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "text": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "text"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "text" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-hint", - "description": "The kind of the component. Must be exactly 'page-hint'" + "description": "The kind of the component. Must be exactly 'page-hint'", + "type": "string", + "const": "page-hint" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "description": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "actionTitle": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "description", "actionTitle"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "description", + "actionTitle" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "buttons-block", - "description": "The kind of the component. Must be exactly 'buttons-block'" + "description": "The kind of the component. Must be exactly 'buttons-block'", + "type": "string", + "const": "buttons-block" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" } }, - "required": ["kind", "builderDisplayName"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "dynamic-button-bar", - "description": "The kind of the component. Must be exactly 'dynamic-button-bar'" + "description": "The kind of the component. Must be exactly 'dynamic-button-bar'", + "type": "string", + "const": "dynamic-button-bar" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "title": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "description": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "title", "description"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "title", + "description" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-button", - "description": "The kind of the component. Must be exactly 'page-button'" + "description": "The kind of the component. Must be exactly 'page-button'", + "type": "string", + "const": "page-button" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "title": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "title"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "title" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-link", - "description": "The kind of the component. Must be exactly 'page-link'" + "description": "The kind of the component. Must be exactly 'page-link'", + "type": "string", + "const": "page-link" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "title": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "caption": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "title", "caption"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "title", + "caption" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-action-row", - "description": "The kind of the component. Must be exactly 'page-action-row'" + "description": "The kind of the component. Must be exactly 'page-action-row'", + "type": "string", + "const": "page-action-row" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "text": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "label": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "image": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { + "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "text", "label", "image"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "text", + "label", + "image" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-rating", - "description": "The kind of the component. Must be exactly 'page-rating'" + "description": "The kind of the component. Must be exactly 'page-rating'", + "type": "string", + "const": "page-rating" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "text": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "label": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "image": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { + "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "text", "label", "image"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "text", + "label", + "image" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "contact-form", - "description": "The kind of the component. Must be exactly 'contact-form'" + "description": "The kind of the component. Must be exactly 'contact-form'", + "type": "string", + "const": "contact-form" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "title": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "description": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "title", "description"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "title", + "description" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "form-container", - "description": "The kind of the component. Must be exactly 'form-container'" + "description": "The kind of the component. Must be exactly 'form-container'", + "type": "string", + "const": "form-container" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" } }, - "required": ["kind", "builderDisplayName"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "breadcrumbs", - "description": "The kind of the component. Must be exactly 'breadcrumbs'" + "description": "The kind of the component. Must be exactly 'breadcrumbs'", + "type": "string", + "const": "breadcrumbs" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" } }, - "required": ["kind", "builderDisplayName"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "inline-scanner", - "description": "The kind of the component. Must be exactly 'inline-scanner'" + "description": "The kind of the component. Must be exactly 'inline-scanner'", + "type": "string", + "const": "inline-scanner" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "writeTo": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "writeTo"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "writeTo" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-signature-field", - "description": "The kind of the component. Must be exactly 'page-signature-field'" + "description": "The kind of the component. Must be exactly 'page-signature-field'", + "type": "string", + "const": "page-signature-field" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "signature": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { + "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "title": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "signature", "title"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "signature", + "title" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-stopwatch", - "description": "The kind of the component. Must be exactly 'page-stopwatch'" + "description": "The kind of the component. Must be exactly 'page-stopwatch'", + "type": "string", + "const": "page-stopwatch" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" } }, - "required": ["kind", "builderDisplayName"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-spinner", - "description": "The kind of the component. Must be exactly 'page-spinner'" + "description": "The kind of the component. Must be exactly 'page-spinner'", + "type": "string", + "const": "page-spinner" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" } }, - "required": ["kind", "builderDisplayName"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "ai-custom-component", - "description": "The kind of the component. Must be exactly 'ai-custom-component'" + "description": "The kind of the component. Must be exactly 'ai-custom-component'", + "type": "string", + "const": "ai-custom-component" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "prompt": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false }, "html": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "prompt", "html"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "prompt", + "html" + ], + "additionalProperties": false }, { + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "const": "page-renderable-content", - "description": "The kind of the component. Must be exactly 'page-renderable-content'" + "description": "The kind of the component. Must be exactly 'page-renderable-content'", + "type": "string", + "const": "page-renderable-content" }, "builderDisplayName": { - "type": "string", - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", + "type": "string" }, "descriptions": { "type": "object", "properties": { "kind": { - "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string", + "const": "string" }, "value": { "type": "string" } }, - "required": ["kind", "value"], + "required": [ + "kind", + "value" + ], "additionalProperties": false } }, - "required": ["kind", "builderDisplayName", "descriptions"], - "additionalProperties": false, - "$schema": "https://json-schema.org/draft/2020-12/schema" + "required": [ + "kind", + "builderDisplayName", + "descriptions" + ], + "additionalProperties": false } -] +] \ No newline at end of file From 4091871b549ac968ee66f476d9919f5ae99522c8 Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Tue, 19 Aug 2025 11:35:56 +1000 Subject: [PATCH 06/16] Fixes missed typescript error --- src/index.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/index.test.ts b/src/index.test.ts index b61bec6..2bac341 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -373,8 +373,9 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle object const values", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", + // @ts-expect-error: @TODO: Resolve, for some reason, the spec and the schema do not align on this const: { key: "value" }, }; @@ -393,8 +394,9 @@ describe("convertJsonSchemaToZod", () => { }); it("should handle array const values", () => { - const jsonSchema = { + const jsonSchema: JSONSchema.BaseSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", + // @ts-expect-error: @TODO: Resolve, for some reason, the spec and the schema do not align on this const: [1, 2, 3], }; From ccdda1bea534bf9fd783eceee718ea7d7305c9d3 Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Tue, 19 Aug 2025 11:36:17 +1000 Subject: [PATCH 07/16] Updates readme for v1.0 information --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2b71170..47891ab 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,9 @@ npm install zod-from-json-schema ## Zod 3 vs 4 -- If you need Zod 4, use the latest version of this package. +Prior to Zod officially releasing an official v4 package, Zod v4 was available in the Zod 3.x branches, i.e. ^3.25.25. This package maintains legacy version 3/4 support in the 0.x version and Zod 4 support (with the official Zod 4 release) in the 1.x version. + +- If you need Zod 4, you can use the ^1.0.0 branch or the ^0.4.0 branches of this repo - If you need Zod 3, use the latest version that's less than 0.4.0 (at the of writing that's 0.0.5). It supports a smaller subsets of JSON Schema. ## Usage From dbc18dae51b73cf2abce61f9b652f04bffa0792e Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Tue, 19 Aug 2025 13:27:15 +1000 Subject: [PATCH 08/16] Updates package-lock --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2e93081..0a4b4cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "zod-from-json-schema", - "version": "0.4.2", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "zod-from-json-schema", - "version": "0.4.2", + "version": "1.0.0", "license": "MIT", "dependencies": { "zod": "^4.0.17" From 5a4731e217548ac5ff8b3cdbbfbc6a0cf48443d5 Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Thu, 21 Aug 2025 10:06:37 +1000 Subject: [PATCH 09/16] Undoes automated JSON formatting changes. --- src/examples.json | 1246 +++++++++++++++------------------------------ 1 file changed, 415 insertions(+), 831 deletions(-) diff --git a/src/examples.json b/src/examples.json index b9a876d..dc140b1 100644 --- a/src/examples.json +++ b/src/examples.json @@ -1,1742 +1,1326 @@ [ { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": {}, - "additionalProperties": false + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "tab": { "type": "string" } }, - "required": [ - "tab" - ], - "additionalProperties": false + "required": ["tab"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "table": { "type": "string" } }, - "required": [ - "table" - ], - "additionalProperties": false + "required": ["table"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "mode": { - "type": "string", - "enum": [ - "Dashboard", - "Data", - "Layout", - "Workflows", - "Settings" - ] + "enum": ["Dashboard", "Data", "Layout", "Workflows", "Settings"] } }, - "required": [ - "mode" - ], - "additionalProperties": false + "required": ["mode"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "filter": { - "description": "Filter the apps by name or description. Looks for substrings.", - "type": "string" + "type": "string", + "description": "Filter the apps by name or description. Looks for substrings." } }, - "additionalProperties": false + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'ai-custom-chat-component'", - "type": "string", - "const": "ai-custom-chat-component" + "const": "ai-custom-chat-component", + "description": "The kind of the component. Must be exactly 'ai-custom-chat-component'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "prompt": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "uuid": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "prompt", - "uuid" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "prompt", "uuid"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'hero'", - "type": "string", - "const": "hero" + "const": "hero", + "description": "The kind of the component. Must be exactly 'hero'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "title": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "titleEmphasized": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "subtitle": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "image": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { - "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "headerImage": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { - "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "title", - "titleEmphasized", - "subtitle", - "image", - "headerImage" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "title", "titleEmphasized", "subtitle", "image", "headerImage"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'fields'", - "type": "string", - "const": "fields" + "const": "fields", + "description": "The kind of the component. Must be exactly 'fields'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "title": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "title" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "title"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-location'", - "type": "string", - "const": "page-location" + "const": "page-location", + "description": "The kind of the component. Must be exactly 'page-location'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "value": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "label": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "value", - "label" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "value", "label"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-image'", - "type": "string", - "const": "page-image" + "const": "page-image", + "description": "The kind of the component. Must be exactly 'page-image'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "title": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "image": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { - "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "caption": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "alt": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "title", - "image", - "caption", - "alt" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "title", "image", "caption", "alt"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-simple-image'", - "type": "string", - "const": "page-simple-image" + "const": "page-simple-image", + "description": "The kind of the component. Must be exactly 'page-simple-image'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "image": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { - "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "alt": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "image", - "alt" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "image", "alt"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-video'", - "type": "string", - "const": "page-video" + "const": "page-video", + "description": "The kind of the component. Must be exactly 'page-video'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "title": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "caption": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "title", - "caption" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "title", "caption"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-simple-video'", - "type": "string", - "const": "page-simple-video" + "const": "page-simple-video", + "description": "The kind of the component. Must be exactly 'page-simple-video'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" } }, - "required": [ - "kind", - "builderDisplayName" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'big-numbers'", - "type": "string", - "const": "big-numbers" + "const": "big-numbers", + "description": "The kind of the component. Must be exactly 'big-numbers'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "title": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "title" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "title"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-web-view'", - "type": "string", - "const": "page-web-view" + "const": "page-web-view", + "description": "The kind of the component. Must be exactly 'page-web-view'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" } }, - "required": [ - "kind", - "builderDisplayName" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-progress'", - "type": "string", - "const": "page-progress" + "const": "page-progress", + "description": "The kind of the component. Must be exactly 'page-progress'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "title": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "description": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "title", - "description" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "title", "description"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-audio'", - "type": "string", - "const": "page-audio" + "const": "page-audio", + "description": "The kind of the component. Must be exactly 'page-audio'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" } }, - "required": [ - "kind", - "builderDisplayName" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-audio-recorder'", - "type": "string", - "const": "page-audio-recorder" + "const": "page-audio-recorder", + "description": "The kind of the component. Must be exactly 'page-audio-recorder'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "saveTo": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "title": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "recordText": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "uploadingText": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "saveTo", - "title", - "recordText", - "uploadingText" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "saveTo", "title", "recordText", "uploadingText"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'container'", - "type": "string", - "const": "container" + "const": "container", + "description": "The kind of the component. Must be exactly 'container'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "backgroundImage": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { - "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "backgroundImage" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "backgroundImage"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-separator'", - "type": "string", - "const": "page-separator" + "const": "page-separator", + "description": "The kind of the component. Must be exactly 'page-separator'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" } }, - "required": [ - "kind", - "builderDisplayName" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'internal-separator'", - "type": "string", - "const": "internal-separator" + "const": "internal-separator", + "description": "The kind of the component. Must be exactly 'internal-separator'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" } }, - "required": [ - "kind", - "builderDisplayName" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'text'", - "type": "string", - "const": "text" + "const": "text", + "description": "The kind of the component. Must be exactly 'text'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "text": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "text" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "text"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-note'", - "type": "string", - "const": "page-note" + "const": "page-note", + "description": "The kind of the component. Must be exactly 'page-note'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "text": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "label": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "text", - "label" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "text", "label"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-rich-text'", - "type": "string", - "const": "page-rich-text" + "const": "page-rich-text", + "description": "The kind of the component. Must be exactly 'page-rich-text'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "text": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "text" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "text"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-hint'", - "type": "string", - "const": "page-hint" + "const": "page-hint", + "description": "The kind of the component. Must be exactly 'page-hint'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "description": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "actionTitle": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "description", - "actionTitle" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "description", "actionTitle"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'buttons-block'", - "type": "string", - "const": "buttons-block" + "const": "buttons-block", + "description": "The kind of the component. Must be exactly 'buttons-block'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" } }, - "required": [ - "kind", - "builderDisplayName" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'dynamic-button-bar'", - "type": "string", - "const": "dynamic-button-bar" + "const": "dynamic-button-bar", + "description": "The kind of the component. Must be exactly 'dynamic-button-bar'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "title": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "description": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "title", - "description" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "title", "description"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-button'", - "type": "string", - "const": "page-button" + "const": "page-button", + "description": "The kind of the component. Must be exactly 'page-button'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "title": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "title" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "title"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-link'", - "type": "string", - "const": "page-link" + "const": "page-link", + "description": "The kind of the component. Must be exactly 'page-link'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "title": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "caption": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "title", - "caption" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "title", "caption"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-action-row'", - "type": "string", - "const": "page-action-row" + "const": "page-action-row", + "description": "The kind of the component. Must be exactly 'page-action-row'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "text": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "label": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "image": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { - "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "text", - "label", - "image" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "text", "label", "image"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-rating'", - "type": "string", - "const": "page-rating" + "const": "page-rating", + "description": "The kind of the component. Must be exactly 'page-rating'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "text": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "label": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "image": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { - "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "text", - "label", - "image" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "text", "label", "image"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'contact-form'", - "type": "string", - "const": "contact-form" + "const": "contact-form", + "description": "The kind of the component. Must be exactly 'contact-form'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "title": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "description": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "title", - "description" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "title", "description"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'form-container'", - "type": "string", - "const": "form-container" + "const": "form-container", + "description": "The kind of the component. Must be exactly 'form-container'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" } }, - "required": [ - "kind", - "builderDisplayName" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'breadcrumbs'", - "type": "string", - "const": "breadcrumbs" + "const": "breadcrumbs", + "description": "The kind of the component. Must be exactly 'breadcrumbs'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" } }, - "required": [ - "kind", - "builderDisplayName" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'inline-scanner'", - "type": "string", - "const": "inline-scanner" + "const": "inline-scanner", + "description": "The kind of the component. Must be exactly 'inline-scanner'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "writeTo": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "writeTo" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "writeTo"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-signature-field'", - "type": "string", - "const": "page-signature-field" + "const": "page-signature-field", + "description": "The kind of the component. Must be exactly 'page-signature-field'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "signature": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { - "type": "string", "const": "https://picsum.photos/seed/picsum/200/300" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "title": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "signature", - "title" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "signature", "title"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-stopwatch'", - "type": "string", - "const": "page-stopwatch" + "const": "page-stopwatch", + "description": "The kind of the component. Must be exactly 'page-stopwatch'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" } }, - "required": [ - "kind", - "builderDisplayName" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-spinner'", - "type": "string", - "const": "page-spinner" + "const": "page-spinner", + "description": "The kind of the component. Must be exactly 'page-spinner'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" } }, - "required": [ - "kind", - "builderDisplayName" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'ai-custom-component'", - "type": "string", - "const": "ai-custom-component" + "const": "ai-custom-component", + "description": "The kind of the component. Must be exactly 'ai-custom-component'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "prompt": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false }, "html": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "prompt", - "html" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "prompt", "html"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" }, { - "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { - "description": "The kind of the component. Must be exactly 'page-renderable-content'", - "type": "string", - "const": "page-renderable-content" + "const": "page-renderable-content", + "description": "The kind of the component. Must be exactly 'page-renderable-content'" }, "builderDisplayName": { - "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"", - "type": "string" + "type": "string", + "description": "The display name of the component in the component palette. Should be a short one or two word description of the component. For example: \"Profile\" or \"Employees\" or \"Reorder\"" }, "descriptions": { "type": "object", "properties": { "kind": { - "description": "Must be exactly 'string'", - "type": "string", - "const": "string" + "const": "string", + "description": "Must be exactly 'string'" }, "value": { "type": "string" } }, - "required": [ - "kind", - "value" - ], + "required": ["kind", "value"], "additionalProperties": false } }, - "required": [ - "kind", - "builderDisplayName", - "descriptions" - ], - "additionalProperties": false + "required": ["kind", "builderDisplayName", "descriptions"], + "additionalProperties": false, + "$schema": "https://json-schema.org/draft/2020-12/schema" } -] \ No newline at end of file +] From 4f28b64b7fe99132c26127a04be113d1ab09bbec Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Thu, 21 Aug 2025 10:07:54 +1000 Subject: [PATCH 10/16] Fixes whitespace formatting --- src/examples.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/examples.json b/src/examples.json index dc140b1..edad9b5 100644 --- a/src/examples.json +++ b/src/examples.json @@ -2,7 +2,7 @@ { "type": "object", "properties": {}, - "additionalProperties": false, + "additionalProperties": false, "$schema": "https://json-schema.org/draft/2020-12/schema" }, { @@ -46,7 +46,7 @@ "description": "Filter the apps by name or description. Looks for substrings." } }, - "additionalProperties": false, + "additionalProperties": false, "$schema": "https://json-schema.org/draft/2020-12/schema" }, { From 1a9cb1a596f547ab77eb506050d8c1f3a265cea5 Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Thu, 21 Aug 2025 11:03:51 +1000 Subject: [PATCH 11/16] Undoes previous commits automatic JSON formatting --- src/examples.json | 286 +++++++++++++++++++++++++++++++--------------- 1 file changed, 191 insertions(+), 95 deletions(-) diff --git a/src/examples.json b/src/examples.json index edad9b5..df4a8d7 100644 --- a/src/examples.json +++ b/src/examples.json @@ -31,9 +31,11 @@ "type": "object", "properties": { "mode": { - "enum": ["Dashboard", "Data", "Layout", "Workflows", "Settings"] + "enum": ["Dashboard", "Data", "Layout", "Workflows", "Settings"], + "type": "string" } }, + "required": ["mode"], "additionalProperties": false, "$schema": "https://json-schema.org/draft/2020-12/schema" @@ -54,7 +56,8 @@ "properties": { "kind": { "const": "ai-custom-chat-component", - "description": "The kind of the component. Must be exactly 'ai-custom-chat-component'" + "description": "The kind of the component. Must be exactly 'ai-custom-chat-component'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -65,7 +68,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -79,7 +83,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -98,7 +103,8 @@ "properties": { "kind": { "const": "hero", - "description": "The kind of the component. Must be exactly 'hero'" + "description": "The kind of the component. Must be exactly 'hero'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -109,7 +115,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -123,7 +130,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -137,7 +145,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -151,10 +160,12 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { - "const": "https://picsum.photos/seed/picsum/200/300" + "const": "https://picsum.photos/seed/picsum/200/300", + "type": "string" } }, "required": ["kind", "value"], @@ -165,10 +176,12 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { - "const": "https://picsum.photos/seed/picsum/200/300" + "const": "https://picsum.photos/seed/picsum/200/300", + "type": "string" } }, "required": ["kind", "value"], @@ -184,7 +197,8 @@ "properties": { "kind": { "const": "fields", - "description": "The kind of the component. Must be exactly 'fields'" + "description": "The kind of the component. Must be exactly 'fields'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -195,7 +209,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -214,7 +229,8 @@ "properties": { "kind": { "const": "page-location", - "description": "The kind of the component. Must be exactly 'page-location'" + "description": "The kind of the component. Must be exactly 'page-location'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -225,7 +241,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -239,7 +256,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -258,7 +276,8 @@ "properties": { "kind": { "const": "page-image", - "description": "The kind of the component. Must be exactly 'page-image'" + "description": "The kind of the component. Must be exactly 'page-image'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -269,7 +288,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -283,10 +303,12 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { - "const": "https://picsum.photos/seed/picsum/200/300" + "const": "https://picsum.photos/seed/picsum/200/300", + "type": "string" } }, "required": ["kind", "value"], @@ -297,7 +319,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -311,7 +334,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -330,7 +354,8 @@ "properties": { "kind": { "const": "page-simple-image", - "description": "The kind of the component. Must be exactly 'page-simple-image'" + "description": "The kind of the component. Must be exactly 'page-simple-image'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -341,10 +366,12 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { - "const": "https://picsum.photos/seed/picsum/200/300" + "const": "https://picsum.photos/seed/picsum/200/300", + "type": "string" } }, "required": ["kind", "value"], @@ -355,7 +382,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -374,7 +402,8 @@ "properties": { "kind": { "const": "page-video", - "description": "The kind of the component. Must be exactly 'page-video'" + "description": "The kind of the component. Must be exactly 'page-video'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -385,7 +414,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -399,7 +429,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -418,7 +449,8 @@ "properties": { "kind": { "const": "page-simple-video", - "description": "The kind of the component. Must be exactly 'page-simple-video'" + "description": "The kind of the component. Must be exactly 'page-simple-video'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -434,7 +466,8 @@ "properties": { "kind": { "const": "big-numbers", - "description": "The kind of the component. Must be exactly 'big-numbers'" + "description": "The kind of the component. Must be exactly 'big-numbers'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -445,7 +478,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -464,7 +498,8 @@ "properties": { "kind": { "const": "page-web-view", - "description": "The kind of the component. Must be exactly 'page-web-view'" + "description": "The kind of the component. Must be exactly 'page-web-view'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -480,7 +515,8 @@ "properties": { "kind": { "const": "page-progress", - "description": "The kind of the component. Must be exactly 'page-progress'" + "description": "The kind of the component. Must be exactly 'page-progress'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -491,7 +527,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -505,7 +542,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -524,7 +562,8 @@ "properties": { "kind": { "const": "page-audio", - "description": "The kind of the component. Must be exactly 'page-audio'" + "description": "The kind of the component. Must be exactly 'page-audio'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -540,7 +579,8 @@ "properties": { "kind": { "const": "page-audio-recorder", - "description": "The kind of the component. Must be exactly 'page-audio-recorder'" + "description": "The kind of the component. Must be exactly 'page-audio-recorder'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -551,7 +591,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -565,7 +606,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -579,7 +621,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -593,7 +636,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -612,7 +656,8 @@ "properties": { "kind": { "const": "container", - "description": "The kind of the component. Must be exactly 'container'" + "description": "The kind of the component. Must be exactly 'container'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -623,10 +668,12 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { - "const": "https://picsum.photos/seed/picsum/200/300" + "const": "https://picsum.photos/seed/picsum/200/300", + "type": "string" } }, "required": ["kind", "value"], @@ -642,7 +689,8 @@ "properties": { "kind": { "const": "page-separator", - "description": "The kind of the component. Must be exactly 'page-separator'" + "description": "The kind of the component. Must be exactly 'page-separator'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -658,7 +706,8 @@ "properties": { "kind": { "const": "internal-separator", - "description": "The kind of the component. Must be exactly 'internal-separator'" + "description": "The kind of the component. Must be exactly 'internal-separator'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -674,7 +723,8 @@ "properties": { "kind": { "const": "text", - "description": "The kind of the component. Must be exactly 'text'" + "description": "The kind of the component. Must be exactly 'text'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -685,7 +735,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -704,7 +755,8 @@ "properties": { "kind": { "const": "page-note", - "description": "The kind of the component. Must be exactly 'page-note'" + "description": "The kind of the component. Must be exactly 'page-note'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -715,7 +767,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -729,7 +782,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -748,7 +802,8 @@ "properties": { "kind": { "const": "page-rich-text", - "description": "The kind of the component. Must be exactly 'page-rich-text'" + "description": "The kind of the component. Must be exactly 'page-rich-text'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -759,7 +814,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -778,7 +834,8 @@ "properties": { "kind": { "const": "page-hint", - "description": "The kind of the component. Must be exactly 'page-hint'" + "description": "The kind of the component. Must be exactly 'page-hint'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -789,7 +846,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -803,7 +861,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -822,7 +881,8 @@ "properties": { "kind": { "const": "buttons-block", - "description": "The kind of the component. Must be exactly 'buttons-block'" + "description": "The kind of the component. Must be exactly 'buttons-block'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -838,7 +898,8 @@ "properties": { "kind": { "const": "dynamic-button-bar", - "description": "The kind of the component. Must be exactly 'dynamic-button-bar'" + "description": "The kind of the component. Must be exactly 'dynamic-button-bar'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -849,7 +910,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -863,7 +925,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -882,7 +945,8 @@ "properties": { "kind": { "const": "page-button", - "description": "The kind of the component. Must be exactly 'page-button'" + "description": "The kind of the component. Must be exactly 'page-button'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -893,7 +957,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -912,7 +977,8 @@ "properties": { "kind": { "const": "page-link", - "description": "The kind of the component. Must be exactly 'page-link'" + "description": "The kind of the component. Must be exactly 'page-link'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -923,7 +989,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -937,7 +1004,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -956,7 +1024,8 @@ "properties": { "kind": { "const": "page-action-row", - "description": "The kind of the component. Must be exactly 'page-action-row'" + "description": "The kind of the component. Must be exactly 'page-action-row'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -967,7 +1036,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -981,7 +1051,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -995,10 +1066,12 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { - "const": "https://picsum.photos/seed/picsum/200/300" + "const": "https://picsum.photos/seed/picsum/200/300", + "type": "string" } }, "required": ["kind", "value"], @@ -1014,7 +1087,8 @@ "properties": { "kind": { "const": "page-rating", - "description": "The kind of the component. Must be exactly 'page-rating'" + "description": "The kind of the component. Must be exactly 'page-rating'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -1025,7 +1099,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -1039,7 +1114,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -1053,10 +1129,12 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { - "const": "https://picsum.photos/seed/picsum/200/300" + "const": "https://picsum.photos/seed/picsum/200/300", + "type": "string" } }, "required": ["kind", "value"], @@ -1072,7 +1150,8 @@ "properties": { "kind": { "const": "contact-form", - "description": "The kind of the component. Must be exactly 'contact-form'" + "description": "The kind of the component. Must be exactly 'contact-form'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -1083,7 +1162,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -1097,7 +1177,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -1116,7 +1197,8 @@ "properties": { "kind": { "const": "form-container", - "description": "The kind of the component. Must be exactly 'form-container'" + "description": "The kind of the component. Must be exactly 'form-container'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -1132,7 +1214,8 @@ "properties": { "kind": { "const": "breadcrumbs", - "description": "The kind of the component. Must be exactly 'breadcrumbs'" + "description": "The kind of the component. Must be exactly 'breadcrumbs'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -1148,7 +1231,8 @@ "properties": { "kind": { "const": "inline-scanner", - "description": "The kind of the component. Must be exactly 'inline-scanner'" + "description": "The kind of the component. Must be exactly 'inline-scanner'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -1159,7 +1243,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -1178,7 +1263,8 @@ "properties": { "kind": { "const": "page-signature-field", - "description": "The kind of the component. Must be exactly 'page-signature-field'" + "description": "The kind of the component. Must be exactly 'page-signature-field'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -1189,10 +1275,12 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { - "const": "https://picsum.photos/seed/picsum/200/300" + "const": "https://picsum.photos/seed/picsum/200/300", + "type": "string" } }, "required": ["kind", "value"], @@ -1203,7 +1291,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -1222,7 +1311,8 @@ "properties": { "kind": { "const": "page-stopwatch", - "description": "The kind of the component. Must be exactly 'page-stopwatch'" + "description": "The kind of the component. Must be exactly 'page-stopwatch'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -1238,7 +1328,8 @@ "properties": { "kind": { "const": "page-spinner", - "description": "The kind of the component. Must be exactly 'page-spinner'" + "description": "The kind of the component. Must be exactly 'page-spinner'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -1254,7 +1345,8 @@ "properties": { "kind": { "const": "ai-custom-component", - "description": "The kind of the component. Must be exactly 'ai-custom-component'" + "description": "The kind of the component. Must be exactly 'ai-custom-component'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -1265,7 +1357,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -1279,7 +1372,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" @@ -1298,7 +1392,8 @@ "properties": { "kind": { "const": "page-renderable-content", - "description": "The kind of the component. Must be exactly 'page-renderable-content'" + "description": "The kind of the component. Must be exactly 'page-renderable-content'", + "type": "string" }, "builderDisplayName": { "type": "string", @@ -1309,7 +1404,8 @@ "properties": { "kind": { "const": "string", - "description": "Must be exactly 'string'" + "description": "Must be exactly 'string'", + "type": "string" }, "value": { "type": "string" From 6e6414f0af35c8f708c234e4a5aa0d3baf345bb6 Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Thu, 21 Aug 2025 11:13:06 +1000 Subject: [PATCH 12/16] Refines JSON import typing from previous commit --- src/examples.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/examples.test.ts b/src/examples.test.ts index cae722f..b61b622 100644 --- a/src/examples.test.ts +++ b/src/examples.test.ts @@ -2,7 +2,9 @@ import { describe, it, expect } from "vitest"; import { convertJsonSchemaToZod } from "./index"; import { z } from "zod/v4"; import type { JSONSchema } from "zod/v4/core"; -import examples from "./examples.json"; +import jsonExampleData from "./examples.json" assert { type: "json"}; +const examples = jsonExampleData as JSONSchema.BaseSchema[]; + // Helper function to find differences between objects function findDifferences(original: any, result: any, path = ""): string[] { @@ -55,7 +57,7 @@ describe("examples tests", () => { it(`should correctly convert example ${index}`, () => { try { // Convert JSON schema to Zod - const zodSchema = convertJsonSchemaToZod(example as unknown as JSONSchema.BaseSchema); + const zodSchema = convertJsonSchemaToZod(example); // Convert Zod schema back to JSON schema const resultSchema = z.toJSONSchema(zodSchema); From d4711ce45a9864903a24882d01f2ac733e4d8003 Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Thu, 21 Aug 2025 11:19:37 +1000 Subject: [PATCH 13/16] Updates Version down from 1.0 to 0.5 from previous commit * As per reviewers request. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6cc1cd5..3edc471 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zod-from-json-schema", - "version": "1.0.0", + "version": "0.5.0", "description": "Creates Zod types from JSON Schema at runtime", "main": "dist/index.js", "module": "dist/index.mjs", From 165fd64ced610bf853a7c86b626d4662766498e9 Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Thu, 21 Aug 2025 11:23:53 +1000 Subject: [PATCH 14/16] Updates package-lock to match version change --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0a4b4cc..131bc6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "zod-from-json-schema", - "version": "1.0.0", + "version": "0.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "zod-from-json-schema", - "version": "1.0.0", + "version": "0.5.0", "license": "MIT", "dependencies": { "zod": "^4.0.17" From f764c80d12487ecbab403f3c85f9afcc8f571d45 Mon Sep 17 00:00:00 2001 From: Aaron Chilcott Date: Thu, 21 Aug 2025 11:32:39 +1000 Subject: [PATCH 15/16] Updates documentation to correct version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 47891ab..5206f80 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ npm install zod-from-json-schema Prior to Zod officially releasing an official v4 package, Zod v4 was available in the Zod 3.x branches, i.e. ^3.25.25. This package maintains legacy version 3/4 support in the 0.x version and Zod 4 support (with the official Zod 4 release) in the 1.x version. -- If you need Zod 4, you can use the ^1.0.0 branch or the ^0.4.0 branches of this repo +- If you need Zod 4, you can use the ^0.5.0 branch or the ^0.4.0 branches of this repo - If you need Zod 3, use the latest version that's less than 0.4.0 (at the of writing that's 0.0.5). It supports a smaller subsets of JSON Schema. ## Usage From db347e24a1ba197c3961b042ffb661f013838019 Mon Sep 17 00:00:00 2001 From: Mark Probst Date: Thu, 21 Aug 2025 07:23:34 -0400 Subject: [PATCH 16/16] Explain versions better, with table --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5206f80..e42fb51 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,15 @@ npm install zod-from-json-schema ## Zod 3 vs 4 -Prior to Zod officially releasing an official v4 package, Zod v4 was available in the Zod 3.x branches, i.e. ^3.25.25. This package maintains legacy version 3/4 support in the 0.x version and Zod 4 support (with the official Zod 4 release) in the 1.x version. +Zod 4 is available both as the package version 4, but also as part of the version 3 packages. We support both, as well as Zod 3. Here's which version of this package to use: -- If you need Zod 4, you can use the ^0.5.0 branch or the ^0.4.0 branches of this repo -- If you need Zod 3, use the latest version that's less than 0.4.0 (at the of writing that's 0.0.5). It supports a smaller subsets of JSON Schema. +|Zod|zod-from-json-schema| +|---|--------------------| +| v4 proper | latest | +| v4 via 3.x | ^0.4.2 | +| v3 | ^0.0.5 | + +Note that the older package for Zod 3 supports a smaller subset of JSON schema than the latest. New features will only be added to the latest. ## Usage