MCPcopy Create free account
hub / github.com/blockmatic/basilic / processComponents

Function processComponents

apps/api/scripts/generate-openapi.ts:47–60  ·  view source on GitHub ↗
(components: Record<string, unknown>)

Source from the content-addressed store, hash-verified

45 }
46 }
47
48 const processComponents = (components: Record<string, unknown>): Record<string, unknown> => {
49 const newComponents: Record<string, unknown> = {}
50 for (const [compKey, compValue] of Object.entries(components))
51 if (compKey === 'schemas' && typeof compValue === 'object' && compValue !== null) {
52 const schemas = compValue as Record<string, unknown>
53 const newSchemas: Record<string, unknown> = {}
54 for (const [schemaKey, schemaValue] of Object.entries(schemas))
55 newSchemas[schemaKey] = removeDefaultsFromRequired(schemaValue)
56 newComponents[compKey] = newSchemas
57 } else {
58 newComponents[compKey] = removeDefaultsFromRequired(compValue)
59 }
60 return newComponents
61 }
62
63 // Recursively process nested objects

Callers 1

Calls 1

Tested by

no test coverage detected