next-openapi-gen 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,7 @@ const getPackageManager = async () => {
19
19
  async function createDocsPage() {
20
20
  const paths = ["app", "api-docs"];
21
21
  const srcPath = path.join(process.cwd(), "src");
22
+ const { outputFile } = openapiTemplate;
22
23
  if (fs.existsSync(srcPath)) {
23
24
  paths.unshift("src");
24
25
  }
@@ -37,7 +38,7 @@ const SwaggerUI = dynamic(() => import("swagger-ui-react"), {
37
38
  export default async function ApiDocsPage() {
38
39
  return (
39
40
  <section>
40
- <SwaggerUI url="/swagger.json" />
41
+ <SwaggerUI url="/${outputFile}" />
41
42
  </section>
42
43
  );
43
44
  }
@@ -11,10 +11,10 @@ export default {
11
11
  description: "Local development server",
12
12
  },
13
13
  ],
14
- paths: {},
15
- apiPath: "./src/app/api",
14
+ apiDir: "./src/app/api",
15
+ schemaDir: "./src",
16
16
  docsUrl: "api-docs",
17
17
  ui: "swagger",
18
- outputPath: "./public/swagger.json",
18
+ outputFile: "swagger.json",
19
19
  includeOpenApiRoutes: true,
20
20
  };
package/package.json CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "next-openapi-gen",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Automatically generate OpenAPI documentation for Next.js API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
8
8
  "typings": "dist/index.d.ts",
9
9
  "bin": {
10
- "next-openapi-gen": "./dist/index"
10
+ "next-openapi-gen": "./dist/index.js"
11
11
  },
12
+ "files": [
13
+ "dist"
14
+ ],
12
15
  "scripts": {
13
16
  "build": "tsc",
14
17
  "prepare": "npm run build"
@@ -1,20 +0,0 @@
1
- /**
2
- * Register a new user !!!
3
- * @desc: Create a new link for authenticated user
4
- * @params: QueryParams
5
- * @body: Input
6
- * @response: Response
7
- */
8
- export async function POST(req) {
9
- const data = await req.json();
10
- return NextResponse.json({}, { status: 201 });
11
- }
12
- /**
13
- * Get user
14
- * @desc: Create a new link
15
- * @params: QueryParams
16
- * @response: Input
17
- */
18
- export async function GET(req) {
19
- return NextResponse.json({}, { status: 201 });
20
- }
@@ -1,11 +0,0 @@
1
- import "swagger-ui-react/swagger-ui.css";
2
- import dynamic from "next/dynamic";
3
- const SwaggerUI = dynamic(() => import("swagger-ui-react"), {
4
- ssr: false,
5
- loading: () => <p>Loading Component...</p>,
6
- });
7
- export default async function ApiDocsPage() {
8
- return (<section>
9
- <SwaggerUI url="/swagger.json"/>
10
- </section>);
11
- }
package/dist/lib/main.js DELETED
@@ -1,23 +0,0 @@
1
- import { OpenApiGenerator } from "./openapi-generator";
2
- const openApiTemplate = {
3
- openapi: "3.0.0",
4
- info: {
5
- title: "My API",
6
- version: "1.0.0",
7
- description: "API description",
8
- },
9
- servers: [
10
- {
11
- url: "http://localhost:3000",
12
- description: "Development server",
13
- },
14
- ],
15
- paths: {},
16
- apiPath: "src/api",
17
- docsUrl: "http://localhost:3000/docs",
18
- ui: "http://localhost:3000/ui",
19
- outputPath: "output/openapi.json",
20
- };
21
- const generator = new OpenApiGenerator();
22
- const apiDocumentation = generator.generate();
23
- console.log(JSON.stringify(apiDocumentation, null, 2));
File without changes