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

Using System.Text.Json Source Generator #1309

Closed
1 task done
IvanJosipovic opened this issue May 26, 2023 · 2 comments
Closed
1 task done

Using System.Text.Json Source Generator #1309

IvanJosipovic opened this issue May 26, 2023 · 2 comments

Comments

@IvanJosipovic
Copy link
Contributor

IvanJosipovic commented May 26, 2023

I'm playing with utilizing the Source Generator approach in the Json Serializer in order to optimize performance of informers.

Benefits of this approach:
image

See these two docs:

Unfortunately, I've hit a snag due to the existing Json converters being internal.

image

Options:

  1. Make existing converters public
  2. Add Source Generation to this library
    1. It appears fairly simple to implement
    2.   KubernetesJson.AddJsonOptions(x => x.TypeInfoResolver = JsonTypeInfoResolver.Combine(SourceGenerationContext.Default, JsonSerializerOptions.Default.TypeInfoResolver));
      
        [JsonSerializable(typeof(V1Node))]
        [JsonSerializable(typeof(V1Namespace))]
        .. add all other types
        internal partial class SourceGenerationContext : JsonSerializerContext
        {
        }
      

Thoughts?

Tasks

Preview Give feedback
  1. approved cncf-cla: yes lgtm size/L
    brendandburns
@tg123
Copy link
Member

tg123 commented May 28, 2023

it is so cool, it is worth to have those converters public

@tg123
Copy link
Member

tg123 commented Jan 14, 2024

merge into #1395

@tg123 tg123 closed this as completed Jan 14, 2024
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 a pull request may close this issue.

2 participants