From 2262174afbc1eb40829d563f9fc050ef27b986f0 Mon Sep 17 00:00:00 2001 From: Ty Tremblay Date: Fri, 13 Dec 2024 18:34:32 -0500 Subject: [PATCH] schema generation adjustments --- .github/workflows/deploy.yml | 2 -- public/schema.json | 3 +++ src/assets/schema.json | 3 +++ src/scripts/generateJsonSchema.ts | 7 ++++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ad93ff8..44a7c6c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -39,8 +39,6 @@ jobs: run: npm install - name: Build run: npm run build - - name: Generate Schema - run: npm run schema - name: Setup Pages uses: actions/configure-pages@v3 - name: Upload artifact diff --git a/public/schema.json b/public/schema.json index 71372ab..114fa43 100644 --- a/public/schema.json +++ b/public/schema.json @@ -101,6 +101,9 @@ ], "additionalProperties": false } + }, + "$schema": { + "type": "string" } }, "required": [ diff --git a/src/assets/schema.json b/src/assets/schema.json index 71372ab..114fa43 100644 --- a/src/assets/schema.json +++ b/src/assets/schema.json @@ -101,6 +101,9 @@ ], "additionalProperties": false } + }, + "$schema": { + "type": "string" } }, "required": [ diff --git a/src/scripts/generateJsonSchema.ts b/src/scripts/generateJsonSchema.ts index d282cdd..3f33654 100644 --- a/src/scripts/generateJsonSchema.ts +++ b/src/scripts/generateJsonSchema.ts @@ -1,6 +1,11 @@ +import { z } from 'zod'; import { zodToJsonSchema } from 'zod-to-json-schema'; import { configSchema } from '../components/inputs/BaseInputProps'; -const schema = zodToJsonSchema(configSchema); +const schemaSchema = configSchema.extend({ + $schema: z.string().optional(), +}); + +const schema = zodToJsonSchema(schemaSchema); console.log(JSON.stringify(schema, null, 2));