I saw there is an openapi plugin for payload that unfortunately does not seem to support v2. Is there anything else that I would have missed ? Cheers.
Actually it seem to work
import fs from "fs/promises";
import path from "path";
import { createDocument, Options } from "payload-openapi";
import loadConfig from "payload/dist/config/load";
(async (
configPath?: string,
outputPath = "doc/spec.json",
options?: Options
) => {
if (configPath) {
process.env.PAYLOAD_CONFIG_PATH = configPath;
}
console.log("????");
const config = await loadConfig();
const apiDocs = await createDocument(config, options);
await fs.mkdir(path.dirname(outputPath), { recursive: true });
await fs.writeFile(outputPath, JSON.stringify(apiDocs, null, 2), "utf-8");
})();
Star
Discord
online
Get dedicated engineering support directly from the Payload team.