mirror of
https://github.com/ritz078/transform.git
synced 2026-11-21 00:32:56 +03:00
* rename exported functions * replace monaco editor with compiled version * fixes * cancel old API requests
17 lines
456 B
TypeScript
17 lines
456 B
TypeScript
import { NextApiRequest, NextApiResponse } from "next";
|
|
import toOpenApi from "@openapi-contrib/json-schema-to-openapi-schema";
|
|
|
|
export default async (req: NextApiRequest, res: NextApiResponse) => {
|
|
try {
|
|
const jsonSchema = req.body;
|
|
|
|
const openApiSchema = await toOpenApi(jsonSchema, {
|
|
cloneSchema: true
|
|
});
|
|
|
|
res.status(200).send(JSON.stringify(openApiSchema, null, 2));
|
|
} catch (e) {
|
|
res.status(500).send(e.message);
|
|
}
|
|
};
|