cal.pub0.org/pages/api/docs.ts

23 lines
684 B
TypeScript
Raw Normal View History

import jsonSchema from "@/json-schema/json-schema.json";
import pjson from "@/package.json";
import { withSwagger } from "next-swagger-doc";
2022-04-15 14:10:57 +00:00
import { withCors } from "@lib/helpers/withCors";
import { withMiddleware } from "@lib/helpers/withMiddleware";
const swaggerHandler = withSwagger({
definition: {
openapi: "3.0.0",
info: {
title: `${pjson.name}: ${pjson.description}`,
version: pjson.version,
},
components: { schemas: { ...jsonSchema.definitions } },
definitions: jsonSchema.definitions,
},
apiFolder: "pages/api",
tags: ["users", "teams", "memeberships"],
sort: true,
});
2022-04-15 14:10:57 +00:00
export default withMiddleware(withCors)(swaggerHandler());