contract testing
This commit is contained in:
@@ -86,12 +86,22 @@ async function processDTOFile(filePath: string, schemas: Record<string, OpenAPIS
|
||||
const className = classMatch[1];
|
||||
const classBody = classMatch[2];
|
||||
|
||||
console.log(` 📝 Processing ${className}`);
|
||||
// Normalize class name to always use DTO suffix (not Dto)
|
||||
const normalizedName = className.endsWith('Dto') ?
|
||||
className.slice(0, -3) + 'DTO' : className;
|
||||
|
||||
console.log(` 📝 Processing ${className} -> ${normalizedName}`);
|
||||
|
||||
// Check for conflicts
|
||||
if (schemas[normalizedName]) {
|
||||
console.warn(` ⚠️ Conflict: ${normalizedName} already exists. Skipping duplicate from ${filePath}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const schema = extractSchemaFromClassBody(classBody, content);
|
||||
if (schema && Object.keys(schema.properties || {}).length > 0) {
|
||||
schemas[className] = schema;
|
||||
console.log(` ✅ Added ${className} with ${Object.keys(schema.properties || {}).length} properties`);
|
||||
schemas[normalizedName] = schema;
|
||||
console.log(` ✅ Added ${normalizedName} with ${Object.keys(schema.properties || {}).length} properties`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user