feat(KubernetesJson): Use of SourceGenerationContext outside AOT#1677
feat(KubernetesJson): Use of SourceGenerationContext outside AOT#1677k8s-ci-robot merged 22 commits intokubernetes-client:masterfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR modifies the Kubernetes client library to enable the use of Source Generation outside of AOT (Ahead-of-Time) compilation scenarios. The changes make the SourceGenerationContext publicly accessible and update serialization code to use type info resolvers that combine source generation with reflection-based fallback when not in AOT mode.
Key Changes:
- Made
SourceGenerationContextpublic instead of internal and removed NET8_0_OR_GREATER conditional compilation - Updated
KubernetesJsonto use a combined type info resolver (source generation + reflection) in non-AOT mode - Consolidated serialization logic by removing the separate AOT-specific
KubernetesJson.csimplementation
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/LibKubernetesGenerator/templates/SourceGenerationContext.cs.template |
Changed visibility from internal to public and removed .NET version guards |
src/KubernetesClient/SourceGenerationContext.cs |
Changed visibility to public and added V1StatusObjectViewConverter to the source generation options |
src/KubernetesClient/Models/V1Status.ObjectView.cs |
Updated deserialization calls to use JsonTypeInfo for AOT compatibility |
src/KubernetesClient/KubernetesJson.cs |
Added type info resolver configuration, changed converter visibility to internal, and updated all serialize/deserialize methods to use GetTypeInfo |
src/KubernetesClient.Classic/KubernetesClient.Classic.csproj |
Added SourceGenerationContext.cs to the classic project compilation |
src/KubernetesClient.Aot/KubernetesJson.cs |
Removed entire AOT-specific implementation file (consolidated into main KubernetesJson.cs) |
src/KubernetesClient.Aot/KubernetesClient.Aot.csproj |
Added references to shared KubernetesJson.cs, SourceGenerationContext.cs, and V1Status.ObjectView.cs files |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@tg123, this PR is ready for review :) |
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 10 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: IvanJosipovic, tg123 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Implements #1674
Note, casting
JsonTypeInfo<TValue>is needed for now dotnet/runtime#118468Source Generator is excluded from the Classic client as it would force C# 9 on net48 projects, dotnet/runtime#87950