(node, selfRef, schemaName)
| 46 | return spec; |
| 47 | |
| 48 | function walk(node, selfRef, schemaName) { |
| 49 | if (!node || typeof node !== 'object') return; |
| 50 | if (Array.isArray(node)) { |
| 51 | for (const child of node) walk(child, selfRef, schemaName); |
| 52 | return; |
| 53 | } |
| 54 | for (const key of ['anyOf', 'oneOf', 'allOf']) { |
| 55 | const arr = node[key]; |
| 56 | if (!Array.isArray(arr)) continue; |
| 57 | for (let i = 0; i < arr.length; i++) { |
| 58 | const item = arr[i]; |
| 59 | if (item && typeof item === 'object' && item.$ref === selfRef) { |
| 60 | arr[i] = { |
| 61 | type: 'object', |
| 62 | title: `${schemaName} (recursive)`, |
| 63 | description: `Recursive reference — same shape as \`${schemaName}\`.` |
| 64 | }; |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | for (const value of Object.values(node)) walk(value, selfRef, schemaName); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | const PRODUCTION_ENDPOINTS = [ |
no outgoing calls
no test coverage detected