MCPcopy Index your code
hub / github.com/simstudioai/sim / generateFieldStructure

Function generateFieldStructure

apps/sim/providers/utils.ts:391–406  ·  view source on GitHub ↗
(field: any)

Source from the content-addressed store, hash-verified

389 if (!responseFormat.fields) return ''
390
391 function generateFieldStructure(field: any): string {
392 if (field.type === 'object' && field.properties) {
393 return `{
394 ${Object.entries(field.properties)
395 .map(([key, prop]: [string, any]) => `"${key}": ${prop.type === 'number' ? '0' : '"value"'}`)
396 .join(',\n ')}
397 }`
398 }
399 return field.type === 'string'
400 ? '"value"'
401 : field.type === 'number'
402 ? '0'
403 : field.type === 'boolean'
404 ? 'true/false'
405 : '[]'
406 }
407
408 const exampleFormat = responseFormat.fields
409 .map((field: any) => ` "${field.name}": ${generateFieldStructure(field)}`)

Callers 1

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected