()
| 40 | ] |
| 41 | |
| 42 | async function run() { |
| 43 | const parts: string[] = [HEADER] |
| 44 | |
| 45 | for (const { name, schema } of schemas) { |
| 46 | const jsonSchema = zodToJsonSchema(schema, { |
| 47 | name, |
| 48 | target: 'jsonSchema7', |
| 49 | $refStrategy: 'none', |
| 50 | }) |
| 51 | |
| 52 | if (name === 'DeepnoteFile') { |
| 53 | // For DeepnoteFile, strip the massive notebooks.blocks array to keep it compact. |
| 54 | // The block schema is already defined in DeepnoteBlock above. |
| 55 | stripBlocksFromFile(jsonSchema) |
| 56 | } |
| 57 | |
| 58 | // biome-ignore lint/suspicious/noExplicitAny: JSON schema types are incompatible between libraries |
| 59 | const ts = await compile(jsonSchema as any, name, { |
| 60 | bannerComment: '', |
| 61 | additionalProperties: false, |
| 62 | unknownAny: false, |
| 63 | style: { singleQuote: true }, |
| 64 | }) |
| 65 | parts.push(ts.trim()) |
| 66 | } |
| 67 | |
| 68 | const output = `${parts.join('\n\n')}\n` |
| 69 | const outPath = path.join('../../skills/deepnote/references/schema.ts') |
| 70 | await fs.mkdir(path.dirname(outPath), { recursive: true }) |
| 71 | await fs.writeFile(outPath, output) |
| 72 | console.log(`Wrote ${outPath}`) |
| 73 | } |
| 74 | |
| 75 | // biome-ignore lint/suspicious/noExplicitAny: walking arbitrary JSON schema structure |
| 76 | function stripBlocksFromFile(schema: any) { |
no test coverage detected