| 840 | |
| 841 | /** Returns true when a property's *direct* type carrier is an internal definition. */ |
| 842 | const propertyReferencesInternal = (propSchema: JSONSchema7): boolean => { |
| 843 | const direct = refToName((propSchema as Record<string, unknown>).$ref); |
| 844 | if (direct && internalTypeNames.has(direct)) return true; |
| 845 | const items = (propSchema as Record<string, unknown>).items; |
| 846 | if (items && typeof items === "object" && !Array.isArray(items)) { |
| 847 | const itemsRef = refToName((items as Record<string, unknown>).$ref); |
| 848 | if (itemsRef && internalTypeNames.has(itemsRef)) return true; |
| 849 | } |
| 850 | const addl = (propSchema as Record<string, unknown>).additionalProperties; |
| 851 | if (addl && typeof addl === "object") { |
| 852 | const addlRef = refToName((addl as Record<string, unknown>).$ref); |
| 853 | if (addlRef && internalTypeNames.has(addlRef)) return true; |
| 854 | } |
| 855 | return false; |
| 856 | }; |
| 857 | |
| 858 | const visit = (node: unknown): void => { |
| 859 | if (!node || typeof node !== "object") return; |