(node: unknown)
| 856 | }; |
| 857 | |
| 858 | const visit = (node: unknown): void => { |
| 859 | if (!node || typeof node !== "object") return; |
| 860 | if (Array.isArray(node)) { |
| 861 | for (const item of node) visit(item); |
| 862 | return; |
| 863 | } |
| 864 | const record = node as Record<string, unknown>; |
| 865 | const props = record.properties; |
| 866 | if (props && typeof props === "object" && !Array.isArray(props)) { |
| 867 | for (const propSchema of Object.values(props as Record<string, unknown>)) { |
| 868 | if (!propSchema || typeof propSchema !== "object") continue; |
| 869 | if (!isSchemaInternal(propSchema as JSONSchema7) && propertyReferencesInternal(propSchema as JSONSchema7)) { |
| 870 | (propSchema as Record<string, unknown>).visibility = "internal"; |
| 871 | } |
| 872 | visit(propSchema); |
| 873 | } |
| 874 | } |
| 875 | for (const key of ["items", "additionalProperties", "anyOf", "allOf", "oneOf"]) { |
| 876 | if (record[key]) visit(record[key]); |
| 877 | } |
| 878 | for (const collectionKey of ["definitions", "$defs"]) { |
| 879 | const collection = record[collectionKey]; |
| 880 | if (collection && typeof collection === "object" && !Array.isArray(collection)) { |
| 881 | for (const def of Object.values(collection as Record<string, unknown>)) { |
| 882 | if (def && typeof def === "object") visit(def); |
| 883 | } |
| 884 | } |
| 885 | } |
| 886 | }; |
| 887 | |
| 888 | visit(schema); |
| 889 | return schema; |
no test coverage detected
searching dependent graphs…