Skip to content

Commit 7fe6841

Browse files
committed
solving for some CA/Roslynator suggestions
1 parent e0c559c commit 7fe6841

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/A2A/Client/A2AClient.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private async IAsyncEnumerable<SseItem<TOutput>> SendRpcSseRequestAsync<TInput,
135135
"text/event-stream",
136136
cancellationToken).ConfigureAwait(false);
137137

138-
var sseParser = SseParser.Create(responseStream, (eventType, data) =>
138+
var sseParser = SseParser.Create(responseStream, (_, data) =>
139139
{
140140
var reader = new Utf8JsonReader(data);
141141

@@ -146,7 +146,12 @@ private async IAsyncEnumerable<SseItem<TOutput>> SendRpcSseRequestAsync<TInput,
146146
throw new A2AException(error.Message, (A2AErrorCode)error.Code);
147147
}
148148

149-
return JsonSerializer.Deserialize(responseObject?.Result, outputTypeInfo) ??
149+
if (responseObject?.Result is null)
150+
{
151+
throw new InvalidOperationException("Failed to deserialize the event: Result is null.");
152+
}
153+
154+
return responseObject.Result.Deserialize(outputTypeInfo) ??
150155
throw new InvalidOperationException("Failed to deserialize the event.");
151156
});
152157

src/A2A/Models/A2AResponse.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,12 @@ namespace A2A;
1010
[JsonDerivedType(typeof(TaskArtifactUpdateEvent), "artifact-update")]
1111
[JsonDerivedType(typeof(Message), "message")]
1212
[JsonDerivedType(typeof(AgentTask), "task")]
13-
public abstract class A2AEvent
14-
{
15-
}
13+
public abstract class A2AEvent;
1614

1715
/// <summary>
1816
/// A2A response objects.
1917
/// </summary>
2018
[JsonPolymorphic(TypeDiscriminatorPropertyName = "kind")]
2119
[JsonDerivedType(typeof(Message), "message")]
2220
[JsonDerivedType(typeof(AgentTask), "task")]
23-
public abstract class A2AResponse : A2AEvent
24-
{
25-
}
21+
public abstract class A2AResponse : A2AEvent;

0 commit comments

Comments
 (0)