2022-04-03 15:47:18 +00:00
|
|
|
import jsonSchema from "@/json-schema/json-schema.json";
|
2022-03-31 20:14:37 +00:00
|
|
|
import pjson from "@/package.json";
|
2022-03-30 14:56:24 +00:00
|
|
|
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";
|
|
|
|
|
2022-03-30 14:56:24 +00:00
|
|
|
const swaggerHandler = withSwagger({
|
|
|
|
definition: {
|
|
|
|
openapi: "3.0.0",
|
|
|
|
info: {
|
2022-03-31 20:14:37 +00:00
|
|
|
title: `${pjson.name}: ${pjson.description}`,
|
|
|
|
version: pjson.version,
|
2022-03-30 14:56:24 +00:00
|
|
|
},
|
2022-04-03 15:47:18 +00:00
|
|
|
components: { schemas: { ...jsonSchema.definitions } },
|
|
|
|
definitions: jsonSchema.definitions,
|
2022-03-30 14:56:24 +00:00
|
|
|
},
|
|
|
|
apiFolder: "pages/api",
|
2022-04-03 15:47:18 +00:00
|
|
|
tags: ["users", "teams", "memeberships"],
|
|
|
|
sort: true,
|
2022-03-30 14:56:24 +00:00
|
|
|
});
|
2022-04-15 14:10:57 +00:00
|
|
|
export default withMiddleware(withCors)(swaggerHandler());
|