MCPcopy Create free account
hub / github.com/Effect-TS/effect / hasFile

Function hasFile

packages/tools/openapi-generator/src/JsonSchemaGenerator.ts:236–254  ·  view source on GitHub ↗
(schema: SchemaRepresentation.Representation, seen: Set<string>)

Source from the content-addressed store, hash-verified

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":

Callers 1

admitFilesFunction · 0.85

Calls 4

multipartCodeFunction · 0.85
someMethod · 0.80
hasMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected