contract testing

This commit is contained in:
2025-12-24 00:01:01 +01:00
parent 43a8afe7a9
commit 5e491d9724
52 changed files with 2058 additions and 612 deletions

View File

@@ -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`);
}
}
}