next-openapi-gen 0.4.4 → 0.4.6

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.
package/README.md CHANGED
@@ -9,7 +9,7 @@ Automatically generate OpenAPI 3.0 documentation from Next.js projects, with sup
9
9
  - ✅ TypeScript types support
10
10
  - ✅ Zod schemas support
11
11
  - ✅ JSDoc comments support
12
- - ✅ Multiple UI interfaces: `Scalar`, `Swagger`, `Redoc`, `Stoplight` and `Rapidoc` available at `/api-docs` url.
12
+ - ✅ Multiple UI interfaces: `Scalar`, `Swagger`, `Redoc`, `Stoplight` and `Rapidoc` available at `/api-docs` url
13
13
  - ✅ Path parameters detection (`/users/{id}`)
14
14
  - ✅ Intelligent parameter examples
15
15
  - ✅ Intuitive CLI for initialization and documentation generation
@@ -16,7 +16,7 @@ export class RouteProcessor {
16
16
  processFileTracker = {};
17
17
  constructor(config) {
18
18
  this.config = config;
19
- this.schemaProcessor = new SchemaProcessor(config.schemaDir);
19
+ this.schemaProcessor = new SchemaProcessor(config.schemaDir, config.schemaType);
20
20
  }
21
21
  /**
22
22
  * Get the SchemaProcessor instance
@@ -50,7 +50,7 @@ export class RouteProcessor {
50
50
  const routePath = this.getRoutePath(filePath);
51
51
  const pathParams = extractPathParameters(routePath);
52
52
  // If we have path parameters but no pathParamsType defined, we should log a warning
53
- if (pathParams.length > 0 && !dataTypes.pathParams) {
53
+ if (pathParams.length > 0 && !dataTypes.pathParamsType) {
54
54
  console.warn(`Route ${routePath} contains path parameters ${pathParams.join(", ")} but no @pathParams type is defined.`);
55
55
  }
56
56
  this.addRouteToPaths(declaration.id.name, filePath, dataTypes);
@@ -67,7 +67,7 @@ export class RouteProcessor {
67
67
  (this.config.includeOpenApiRoutes && dataTypes.isOpenApi)) {
68
68
  const routePath = this.getRoutePath(filePath);
69
69
  const pathParams = extractPathParameters(routePath);
70
- if (pathParams.length > 0 && !dataTypes.pathParams) {
70
+ if (pathParams.length > 0 && !dataTypes.pathParamsType) {
71
71
  console.warn(`Route ${routePath} contains path parameters ${pathParams.join(", ")} but no @pathParams type is defined.`);
72
72
  }
73
73
  this.addRouteToPaths(decl.id.name, filePath, dataTypes);
package/dist/lib/utils.js CHANGED
@@ -18,10 +18,10 @@ export function extractJSDocComments(path) {
18
18
  const comments = path.node.leadingComments;
19
19
  let summary = "";
20
20
  let description = "";
21
- let params = "";
22
- let pathParams = "";
23
- let body = "";
24
- let response = "";
21
+ let paramsType = "";
22
+ let pathParamsType = "";
23
+ let bodyType = "";
24
+ let responseType = "";
25
25
  let auth = "";
26
26
  let isOpenApi = false;
27
27
  if (comments) {
@@ -51,16 +51,16 @@ export function extractJSDocComments(path) {
51
51
  description = commentValue.match(regex)[1].trim();
52
52
  }
53
53
  if (commentValue.includes("@params")) {
54
- params = extractTypeFromComment(commentValue, "@params");
54
+ paramsType = extractTypeFromComment(commentValue, "@params");
55
55
  }
56
56
  if (commentValue.includes("@pathParams")) {
57
- pathParams = extractTypeFromComment(commentValue, "@pathParams");
57
+ pathParamsType = extractTypeFromComment(commentValue, "@pathParams");
58
58
  }
59
59
  if (commentValue.includes("@body")) {
60
- body = extractTypeFromComment(commentValue, "@body");
60
+ bodyType = extractTypeFromComment(commentValue, "@body");
61
61
  }
62
62
  if (commentValue.includes("@response")) {
63
- response = extractTypeFromComment(commentValue, "@response");
63
+ responseType = extractTypeFromComment(commentValue, "@response");
64
64
  }
65
65
  });
66
66
  }
@@ -68,10 +68,10 @@ export function extractJSDocComments(path) {
68
68
  auth,
69
69
  summary,
70
70
  description,
71
- params,
72
- pathParams,
73
- body,
74
- response,
71
+ paramsType,
72
+ pathParamsType,
73
+ bodyType,
74
+ responseType,
75
75
  isOpenApi,
76
76
  };
77
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-openapi-gen",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Automatically generate OpenAPI 3.0 documentation from Next.js projects, with support for TypeScript types and Zod schemas.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",