| 56 | |
| 57 | // Generate TypeScript code for nested object |
| 58 | function generateNestedObject(obj, indent = 0) { |
| 59 | const spaces = ' '.repeat(indent) |
| 60 | const lines = [] |
| 61 | |
| 62 | for (const [key, value] of Object.entries(obj)) |
| 63 | if (typeof value === 'string') { |
| 64 | lines.push(`${spaces}${key}: gen.${value},`) |
| 65 | } else { |
| 66 | lines.push(`${spaces}${key}: {`) |
| 67 | lines.push(...generateNestedObject(value, indent + 1)) |
| 68 | lines.push(`${spaces}},`) |
| 69 | } |
| 70 | |
| 71 | return lines |
| 72 | } |
| 73 | |
| 74 | // Collect all operationIds from nested structure (for import list) |
| 75 | function collectOperationIds(obj, acc = new Set()) { |