Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions deploy/examples.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import fs from "fs";

import { IOpenAiDocument, OpenAiComposer } from "../src";

const PATH = `${__dirname}/../examples`;

const main = async (): Promise<void> => {
const fileList: string[] = await fs.promises.readdir(`${PATH}/swagger`);
for (const file of fileList) {
const swagger: any = JSON.parse(
await fs.promises.readFile(`${PATH}/swagger/${file}`, "utf8"),
);
for (const keyword of [true, false]) {
const document: IOpenAiDocument = OpenAiComposer.document({
swagger,
options: { keyword },
});
await fs.promises.writeFile(
`${PATH}/${keyword ? "keyword" : "positional"}/${file}`,
JSON.stringify(document, null, 2),
);
}
}
};
main().catch(console.error);
Loading