next-openapi-gen 0.8.6 → 0.8.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.
- package/dist/lib/zod-converter.js +12 -0
- package/package.json +1 -1
|
@@ -700,6 +700,16 @@ export class ZodSchemaConverter {
|
|
|
700
700
|
}
|
|
701
701
|
logger.debug(`[processZodNode] Could not expand factory function '${node.callee.name}' - missing context or not a factory`);
|
|
702
702
|
}
|
|
703
|
+
// Handle standalone identifier references (e.g., userSchema used directly)
|
|
704
|
+
if (t.isIdentifier(node)) {
|
|
705
|
+
const schemaName = node.name;
|
|
706
|
+
// Try to find and process the referenced schema
|
|
707
|
+
if (!this.zodSchemas[schemaName]) {
|
|
708
|
+
this.convertZodSchemaToOpenApi(schemaName);
|
|
709
|
+
}
|
|
710
|
+
// Return a reference to the schema
|
|
711
|
+
return { $ref: `#/components/schemas/${schemaName}` };
|
|
712
|
+
}
|
|
703
713
|
logger.debug("Unknown Zod schema node:", node);
|
|
704
714
|
return { type: "object" };
|
|
705
715
|
}
|
|
@@ -932,6 +942,7 @@ export class ZodSchemaConverter {
|
|
|
932
942
|
$ref: `#/components/schemas/${referencedSchemaName}`,
|
|
933
943
|
};
|
|
934
944
|
required.push(propName); // Assuming it's required unless marked optional
|
|
945
|
+
return; // Skip further processing for this property
|
|
935
946
|
}
|
|
936
947
|
// For array of schemas (like z.array(PaymentMethodSchema))
|
|
937
948
|
if (t.isCallExpression(prop.value) &&
|
|
@@ -957,6 +968,7 @@ export class ZodSchemaConverter {
|
|
|
957
968
|
if (!isOptional) {
|
|
958
969
|
required.push(propName);
|
|
959
970
|
}
|
|
971
|
+
return; // Skip further processing for this property
|
|
960
972
|
}
|
|
961
973
|
// Process property value (a Zod schema)
|
|
962
974
|
const propSchema = this.processZodNode(prop.value);
|
package/package.json
CHANGED