Declare server-consumed command response types - #2540
Merged
Conversation
| /// <returns>True if the value is handled on the server and should not be exposed as a client response.</returns> | ||
| public static bool IsServerHandledCommandResponseValue(this Type type) | ||
| { | ||
| var isFromCurrentMetadataContext = _metadataLoadContext?.GetAssemblies().Contains(type.Assembly) == true; |
| var version = Path.GetFileName(root)!; | ||
| var framework = Directory.GetParent(root)!; | ||
| var shared = Directory.GetParent(framework.FullName)!; | ||
| var aspNetCoreAppPath = Path.Combine(shared.FullName, "Microsoft.AspNetCore.App", version); |
Comment on lines
+1284
to
+1287
| var nugetCachePath = Path.Combine( | ||
| Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), | ||
| ".nuget", | ||
| "packages"); |
| ".nuget", | ||
| "packages"); | ||
|
|
||
| var fullPath = Path.Combine(nugetCachePath, fundamentalsPackage.Path!, assetPaths[0]); |
|
|
||
| void Establish() | ||
| { | ||
| _invalidAssemblyFile = Path.Combine(Path.GetTempPath(), $"proxy-generator-invalid-{Guid.NewGuid():N}.dll"); |
| void Establish() | ||
| { | ||
| _invalidAssemblyFile = Path.Combine(Path.GetTempPath(), $"proxy-generator-invalid-{Guid.NewGuid():N}.dll"); | ||
| _outputPath = Path.Combine(Path.GetTempPath(), $"proxy-generator-output-{Guid.NewGuid():N}"); |
|
|
||
| void Establish() | ||
| { | ||
| _invalidAssemblyFile = Path.Combine(Path.GetTempPath(), $"proxy-generator-invalid-{Guid.NewGuid():N}.dll"); |
Contributor
Author
|
Reviewer context moved out of the description (release notes are generated from it): Internal changes (no user-facing effect): metadata load-context ownership is bounded to each generator invocation; dynamically-registered handlers stay runtime-only so ordinary DTO responses are not suppressed; SSH.NET pinned past GHSA-q939-rpr3-3284 (transitive test-only dependency via Testcontainers); proxy generator test artifacts added to the solution graph. Verification (from the original description):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Command response value handlers can now declare the response type they consume, and the proxy generator uses these declarations to stop generating client response models for values that are handled on the server and never reach the client.
Added
ICommandResponseValueHandler<TValue>, an optional typed declaration that marks a command response value type as consumed on the server (Let a command response value handler declare its consumed type so the proxy generator stops emitting it #2537)Changed
Result,OneOf, tuples, or collections (Let a command response value handler declare its consumed type so the proxy generator stops emitting it #2537)Fixed