UNPKG

@eldev/business-central-api

Version:

A Dynamics 365 Business Central client for TypeScript

26 lines 801 B
export async function parseSchema(schema, input) { let result = schema["~standard"].validate(input); if (result instanceof Promise) result = await result; if (result.issues) { const issues = result.issues.map((issue) => { const pathSegments = issue.path?.map((segment) => { if (typeof segment === "object" && "key" in segment) { return String(segment.key); } return String(segment); }) || []; return { message: issue.message, path: pathSegments.join(".") || "root", }; }); return { issues, }; } return { data: result.value, }; } //# sourceMappingURL=parse-schema.js.map