Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/StreamJsonRpc/RpcTargetMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ public static RpcTargetMetadata FromShape<T, TProvider>()
/// <typeparam name="T">The type for which a shape should be obtained and <see cref="RpcTargetMetadata"/> generated for.</typeparam>
/// <param name="provider">The provider of type shapes from which to obtain the shape.</param>
/// <returns>An <see cref="RpcTargetMetadata"/> instance initialized from the shape of the <typeparamref name="T"/>.</returns>
[Obsolete("Use FromShape(ITypeShape) instead. This API will be removed soon.")]
public static RpcTargetMetadata FromShape<T>(ITypeShapeProvider provider) => FromShape(provider.GetTypeShapeOrThrow<T>());

/// <summary>
Expand Down
4 changes: 1 addition & 3 deletions test/StreamJsonRpc.Tests/RpcTargetMetadataTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using PolyType;

public partial class RpcTargetMetadataTests
{
internal interface IRpcContractBase
Expand Down Expand Up @@ -45,7 +43,7 @@ internal partial interface IShapedContract
[Fact]
public void FromShape()
{
RpcTargetMetadata metadata = RpcTargetMetadata.FromShape<IShapedContract>(Witness.GeneratedTypeShapeProvider);
RpcTargetMetadata metadata = RpcTargetMetadata.FromShape(PolyType.SourceGenerator.TypeShapeProvider_StreamJsonRpc_Tests.Default.IShapedContract);

var addAsync = Assert.Single(metadata.Methods["AddAsync"]);
var add = Assert.Single(metadata.AliasedMethods["Add"]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using PolyType;

public partial class TargetObjectEventsNerdbankMessagePackTests(ITestOutputHelper logger) : TargetObjectEventsTests(logger)
public partial class TargetObjectEventsNerdbankMessagePackTests(ITestOutputHelper logger) : TargetObjectEventsTests(logger)
{
protected override void InitializeFormattersAndHandlers()
{
Expand All @@ -14,7 +12,7 @@ protected override void InitializeFormattersAndHandlers()
protected override JsonRpc CreateJsonRpcWithTargetObject<T>(IJsonRpcMessageHandler messageHandler, T targetObject, JsonRpcTargetOptions? options)
{
JsonRpc jsonRpc = new(messageHandler);
jsonRpc.AddLocalRpcTarget(RpcTargetMetadata.FromShape<T>(Witness.GeneratedTypeShapeProvider), targetObject, options);
jsonRpc.AddLocalRpcTarget(RpcTargetMetadata.FromShape(Witness.GeneratedTypeShapeProvider.GetTypeShapeOrThrow<T>()), targetObject, options);
return jsonRpc;
}

Expand Down
Loading