-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
Having a complex member inside an XoObject which has no members by itself, creates a wrong JSON (the empty JSON has a key "" instead).
A {
}
B {
a: A
}
Encoding B leads to
{
a: {
"": undefined
}
}
Proposed Solution
In xo-utils.ts
static copyProperty(src: Xo, dst: Xo, path: string): void {
const xoPath = XoUtil.sanitizePath(path);
const result = XoUtil.resolveCreate(dst, xoPath);
const pathToCopy = (result.value || result?.unresolvedPath?.head === '') ? xoPath : result.resolvedPath.concat(result.unresolvedPath.head).join('.');
dst.resolveAssign(pathToCopy, src.resolve(pathToCopy));
}
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers