(schema: SchemaRepresentation.Representation, seen: Set<string>)
| 234 | ): (schema: SchemaRepresentation.Representation, name: string) => SchemaRepresentation.Representation { |
| 235 | if (refs === undefined) return (schema) => schema |
| 236 | const hasFile = (schema: SchemaRepresentation.Representation, seen: Set<string>): boolean => { |
| 237 | switch (schema._tag) { |
| 238 | case "Reference": { |
| 239 | if (multipartCode(schema.$ref, refs) !== undefined) return true |
| 240 | if (seen.has(schema.$ref) || !Object.hasOwn(references, schema.$ref)) return false |
| 241 | seen.add(schema.$ref) |
| 242 | return hasFile(references[schema.$ref], seen) |
| 243 | } |
| 244 | case "Suspend": |
| 245 | return hasFile(schema.thunk, seen) |
| 246 | case "Union": |
| 247 | return schema.types.some((member) => hasFile(member, seen)) |
| 248 | case "Arrays": |
| 249 | return schema.rest.some((member) => hasFile(member, seen)) || |
| 250 | schema.elements.some((element) => hasFile(element.type, seen)) |
| 251 | default: |
| 252 | return false |
| 253 | } |
| 254 | } |
| 255 | const admitFiles = (schema: SchemaRepresentation.Representation): SchemaRepresentation.Representation => { |
| 256 | switch (schema._tag) { |
| 257 | case "Suspend": |
no test coverage detected