Skip to content

Commit 4c4b7b1

Browse files
committed
fix: fix openapi schema
1 parent 973d186 commit 4c4b7b1

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

‎bun.lock‎

Lines changed: 3 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎index.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import fs from "node:fs";
22
import path from "node:path";
33
import { parseArgs } from "node:util";
44
import { z } from "zod";
5+
import { createDocument } from 'zod-openapi';
56

67
const topicsDir = path.join(__dirname, "./metadata/topics");
78
const languagesDir = path.join(__dirname, "./metadata/languages");
@@ -212,7 +213,19 @@ function main() {
212213
target: "openapi-3.0",
213214
reused: "inline",
214215
});
215-
console.log(JSON.stringify(jsonSchema, null, 2));
216+
217+
const openApiDocument = {
218+
openapi: "3.0.0",
219+
info: {
220+
title: "Learning Resources",
221+
version: "1.0.0",
222+
description: "// Generated by index.ts - DO NOT EDIT THIS FILE DIRECTLY"
223+
},
224+
paths: {},
225+
226+
components: jsonSchema.components || { schemas: {} }
227+
};
228+
console.log(JSON.stringify(openApiDocument, null, 2));
216229
process.exit(0);
217230
}
218231

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"devDependencies": {
2121
"@types/bun": "latest",
2222
"ajv-cli": "^5.0.0",
23-
"ajv-formats": "^3.0.1"
23+
"ajv-formats": "^3.0.1",
24+
"zod-openapi": "^5.4.6"
2425
},
2526
"peerDependencies": {
2627
"typescript": "^5 || ^6.0.0"

0 commit comments

Comments
 (0)