-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Labels
bug 🐞Something isn't workingSomething isn't working
Description
What happened:
The current implementation of the toJSON method does not account for the JSON encoding of Bytes and Date types in the primitives. This omission can lead to incorrect serialization of these data types when they are expected to be properly formatted in JSON.
yorkie-js-sdk/packages/sdk/src/document/crdt/primitive.ts
Lines 101 to 112 in 5d4ded9
| /** | |
| * `toJSON` returns the JSON encoding of the value. | |
| */ | |
| public toJSON(): string { | |
| if (this.valueType === PrimitiveType.String) { | |
| return `"${escapeString(this.value as string)}"`; | |
| } | |
| // TODO(hackerwins): We need to consider the case where the value is | |
| // a byte array and a date. | |
| return `${this.value}`; | |
| } |
What you expected to happen:
The toJSON method should return a well-formed JSON representation for Bytes and Date, ensuring proper serialization of these types when used.
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
Environment:
- Yorkie JS SDK version: 0.5.2
hackerwins
Metadata
Metadata
Assignees
Labels
bug 🐞Something isn't workingSomething isn't working