| 48 | const schemasDir = path.resolve(__dirname, '../../../static/schemas/source'); |
| 49 | const derived = new Set<string>(); |
| 50 | const walk = (d: string) => { |
| 51 | for (const entry of fs.readdirSync(d, { withFileTypes: true })) { |
| 52 | const p = path.join(d, entry.name); |
| 53 | if (entry.isDirectory()) { walk(p); continue; } |
| 54 | if (!entry.name.endsWith('-request.json')) continue; |
| 55 | let schema: { required?: unknown }; |
| 56 | try { schema = JSON.parse(fs.readFileSync(p, 'utf8')) as { required?: unknown }; } |
| 57 | catch { continue; } |
| 58 | const req = Array.isArray(schema.required) ? schema.required : []; |
| 59 | if (req.includes('idempotency_key')) { |
| 60 | derived.add(entry.name.replace(/-request\.json$/, '').replace(/-/g, '_')); |
| 61 | } |
| 62 | } |
| 63 | }; |
| 64 | walk(schemasDir); |
| 65 | |
| 66 | const actual = new Set(MUTATING_TOOLS); |