Skip to content
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

Improving how the @context property is serialized #176

Open
Turnerj opened this issue Jun 4, 2020 · 0 comments
Open

Improving how the @context property is serialized #176

Turnerj opened this issue Jun 4, 2020 · 0 comments
Labels
enhancement Issues describing an enhancement or pull requests adding an enhancement. help wanted Help wanted from the community.

Comments

@Turnerj
Copy link
Collaborator

Turnerj commented Jun 4, 2020

Describe the feature

Currently the @context property is always serialized. Using our SchemaSerializer class, we keep the outer @context property but we replace all inner @context properties by a StringBuilder.Replace call which means we allocate the whole JSON output as a string twice.

Ideally, we need a way to conditionally serialize the @context property only if it is the root object of serialization.

How to actually implement this (especially in a future System.Text.Json world) remains unknown however it should still be considered. Potentially if we can provide a custom converter for the root-level object that can output that property and for any nested properties, simply not pass that converter down - this may give us our desired effect.

@Turnerj Turnerj added enhancement Issues describing an enhancement or pull requests adding an enhancement. help wanted Help wanted from the community. labels Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues describing an enhancement or pull requests adding an enhancement. help wanted Help wanted from the community.
Projects
None yet
Development

No branches or pull requests

1 participant