next-openapi-gen 0.9.1 → 0.9.2
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 +1 -1
- package/dist/lib/utils.js +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -213,7 +213,7 @@ export async function POST(request: NextRequest) {
|
|
|
213
213
|
| `@description` | Endpoint description |
|
|
214
214
|
| `@operationId` | Custom operation ID (overrides auto-generated ID) |
|
|
215
215
|
| `@pathParams` | Path parameters type/schema |
|
|
216
|
-
| `@params` | Query parameters type/schema
|
|
216
|
+
| `@params` | Query parameters type/schema (use `@queryParams` if you have prettier-plugin-jsdoc conflicts) |
|
|
217
217
|
| `@body` | Request body type/schema |
|
|
218
218
|
| `@bodyDescription` | Request body description |
|
|
219
219
|
| `@response` | Response type/schema with optional code and description (`User`, `201:User`, `User:Description`, `201:User:Description`) |
|
package/dist/lib/utils.js
CHANGED
|
@@ -85,8 +85,9 @@ export function extractJSDocComments(path) {
|
|
|
85
85
|
tag = match[1].trim();
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
if (commentValue.includes("@params")) {
|
|
89
|
-
paramsType = extractTypeFromComment(commentValue, "@
|
|
88
|
+
if (commentValue.includes("@params") || commentValue.includes("@queryParams")) {
|
|
89
|
+
paramsType = extractTypeFromComment(commentValue, "@queryParams") ||
|
|
90
|
+
extractTypeFromComment(commentValue, "@params");
|
|
90
91
|
}
|
|
91
92
|
if (commentValue.includes("@pathParams")) {
|
|
92
93
|
pathParamsType = extractTypeFromComment(commentValue, "@pathParams");
|
|
@@ -169,8 +170,9 @@ export function extractJSDocComments(path) {
|
|
|
169
170
|
}
|
|
170
171
|
export function extractTypeFromComment(commentValue, tag) {
|
|
171
172
|
// Updated regex to support generic types with angle brackets and array brackets
|
|
173
|
+
// Use multiline mode (m flag) to match tag at start of line (after optional * from JSDoc)
|
|
172
174
|
return (commentValue
|
|
173
|
-
.match(new RegExp(
|
|
175
|
+
.match(new RegExp(`^\\s*\\*?\\s*${tag}\\s+([\\w<>,\\s\\[\\]]+)`, 'm'))?.[1]
|
|
174
176
|
?.trim() || "");
|
|
175
177
|
}
|
|
176
178
|
export function cleanComment(commentValue) {
|
package/package.json
CHANGED