const typeMap: Record = { number: { type: 'integer', format: 'int64' }, string: { type: 'string' }, Date: { type: 'string', format: 'date-time' }, boolean: { type: 'boolean' }, } export async function modelToSchema(model: any) { const properties: Record = {} for (const [key, meta] of model.$columnsDefinitions.entries()) { const tsType = meta.meta?.designType?.name || 'string' const mapped = typeMap[tsType] ?? { type: 'string' } properties[meta?.serializeAs || key] = { ...mapped, description: key.replace(/([A-Z])/g, ' $1').trim(), } } return JSON.stringify(properties) }