Skip to content

Commit bec83d2

Browse files
bug fix: deserializing subscription start requests (#113)
* fixed a regression bug where subscription start requests were unable to deserialize a variables collection
1 parent 18aac9d commit bec83d2

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/graphql-aspnet-subscriptions/Engine/DefaultGraphQLHttpSubscriptionMiddleware.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ await this.WriteErrorToClientAndCloseAsync(
169169
clientConnection,
170170
(int)ConnectionCloseStatus.ProtocolError,
171171
(int)HttpStatusCode.BadRequest,
172-
$"The requested messaging protocol(s) '{uspe.Protocol}' are not supported " +
173-
"by the target schema.")
172+
$"The requested messaging protocol(s) '{uspe.Protocol}' are not supported.")
174173
.ConfigureAwait(false);
175174
}
176175
catch (Exception ex)
@@ -181,8 +180,7 @@ await this.WriteErrorToClientAndCloseAsync(
181180
clientConnection,
182181
(int)ConnectionCloseStatus.InternalServerError,
183182
(int)HttpStatusCode.InternalServerError,
184-
"An unexpected error occured attempting to configure the web socket " +
185-
"connection. Check the server event logs for further details.")
183+
"An unexpected error occured attempting to configure the web socket.")
186184
.ConfigureAwait(false);
187185
}
188186
finally

src/graphql-aspnet-subscriptions/SubscriptionServer/Protocols/GraphqlTransportWs/GqltwsClientProxy.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ namespace GraphQL.AspNet.SubscriptionServer.Protocols.GraphqlTransportWs
1919
using System.Threading.Tasks;
2020
using GraphQL.AspNet.Common;
2121
using GraphQL.AspNet.Execution;
22+
using GraphQL.AspNet.Execution.Variables.Json;
2223
using GraphQL.AspNet.Interfaces.Engine;
2324
using GraphQL.AspNet.Interfaces.Execution;
2425
using GraphQL.AspNet.Interfaces.Logging;
@@ -54,6 +55,9 @@ static GqltwsClientProxy()
5455
_deserializerOptions.PropertyNameCaseInsensitive = true;
5556
_deserializerOptions.AllowTrailingCommas = true;
5657
_deserializerOptions.ReadCommentHandling = JsonCommentHandling.Skip;
58+
59+
_deserializerOptions.Converters.Add(new IInputVariableCollectionConverter());
60+
_deserializerOptions.Converters.Add(new InputVariableCollectionConverter());
5761
}
5862

5963
private readonly bool _enableMetrics;
@@ -99,9 +103,8 @@ public GqltwsClientProxy(
99103
/// <returns>Task.</returns>
100104
private async Task ResponseToUnknownMessageAsync(GqltwsMessage lastMessage)
101105
{
102-
var error = "The last message recieved was unknown or could not be processed " +
103-
$"by this server. This connection is configured to use the {GqltwsConstants.PROTOCOL_NAME} " +
104-
$"message schema. (messageType: '{lastMessage.Type}')";
106+
var error = $"The last message recieved could not be processed (Protocol: {GqltwsConstants.PROTOCOL_NAME}) " +
107+
$"(MessageType: '{lastMessage.Type}').";
105108

106109
await this.CloseConnectionAsync(
107110
(ConnectionCloseStatus)GqltwsConstants.CustomCloseEventIds.InvalidMessageType,

src/graphql-aspnet-subscriptions/SubscriptionServer/Protocols/GraphqlWsLegacy/GraphqlWsLegacyClientProxy.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace GraphQL.AspNet.SubscriptionServer.Protocols.GraphqlWsLegacy
1818
using System.Threading;
1919
using System.Threading.Tasks;
2020
using GraphQL.AspNet.Common;
21+
using GraphQL.AspNet.Execution.Variables.Json;
2122
using GraphQL.AspNet.Interfaces.Engine;
2223
using GraphQL.AspNet.Interfaces.Execution;
2324
using GraphQL.AspNet.Interfaces.Logging;
@@ -52,6 +53,9 @@ static GraphqlWsLegacyClientProxy()
5253
_deserializeOptions.PropertyNameCaseInsensitive = true;
5354
_deserializeOptions.AllowTrailingCommas = true;
5455
_deserializeOptions.ReadCommentHandling = JsonCommentHandling.Skip;
56+
57+
_deserializeOptions.Converters.Add(new IInputVariableCollectionConverter());
58+
_deserializeOptions.Converters.Add(new InputVariableCollectionConverter());
5559
}
5660

5761
private readonly bool _enableMetrics;

0 commit comments

Comments
 (0)