next-openapi-gen 0.10.4 → 0.10.5

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.
@@ -148,9 +148,9 @@ export class PagesRouterStrategy {
148
148
  if (respSetMatch) {
149
149
  responseSet = respSetMatch[1].trim();
150
150
  }
151
- const addMatch = cleanedComment.match(/@add\s+(.*)/);
152
- if (addMatch) {
153
- addResponses = addMatch[1].trim();
151
+ const addMatches = [...cleanedComment.matchAll(/@add\s+([^\n\r@]*)/g)];
152
+ if (addMatches.length > 0) {
153
+ addResponses = addMatches.map((m) => m[1].trim()).join(",");
154
154
  }
155
155
  const opIdMatch = cleanedComment.match(/@operationId\s+(\S+)/);
156
156
  if (opIdMatch) {
@@ -102,6 +102,8 @@ export class RouteProcessor {
102
102
  customResponses.forEach((responseRef) => {
103
103
  const [code, ref] = responseRef.split(":");
104
104
  if (ref) {
105
+ // Ensure the referenced schema is resolved (triggers Zod converter)
106
+ this.schemaProcessor.getSchemaContent({ responseType: ref });
105
107
  // Custom schema: "409:ConflictResponse"
106
108
  // 204 No Content should not have a content section per HTTP/OpenAPI spec
107
109
  if (code === "204") {
package/dist/lib/utils.js CHANGED
@@ -123,10 +123,9 @@ export function extractJSDocComments(path) {
123
123
  }
124
124
  }
125
125
  if (commentValue.includes("@add")) {
126
- const regex = /@add\s*(.*)/;
127
- const match = commentValue.match(regex);
128
- if (match && match[1]) {
129
- addResponses = match[1].trim();
126
+ const matches = [...commentValue.matchAll(/@add\s+([^\n\r@]*)/g)];
127
+ if (matches.length > 0) {
128
+ addResponses = matches.map((m) => m[1].trim()).join(",");
130
129
  }
131
130
  }
132
131
  if (commentValue.includes("@operationId")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-openapi-gen",
3
- "version": "0.10.4",
3
+ "version": "0.10.5",
4
4
  "description": "Automatically generate OpenAPI 3.0 documentation from Next.js projects, with support for Zod schemas and TypeScript types.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",