Skip to content

DynamicSerializer: encode dynamic values in place #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

swankjesse
Copy link
Owner

Copy link
Owner Author

@swankjesse swankjesse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The biggest hazard with this implementation is that when it’s used with decodeFromDynamic, there’s no deep copy!

val value = js("{a: 42}")
assertEquals("""{"a":42}""", JSON.stringify(Json.encodeToDynamic(DynamicSerializer, value)))
assertEquals("""{"a":42}""", JSON.stringify(Json.decodeFromDynamic(DynamicSerializer, value)))
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m happy to write a ton of tests for this. I think it needs tests for various inputs and also various JSON encoder types (dynamic, stream, tree)

private open class DynamicInput(
protected val value: dynamic,
internal open class DynamicInput(
internal val value: dynamic,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both necessary for dynamic decoder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants