@@ -18,10 +18,13 @@ public struct ConnectionAckResponse: Equatable, JsonEncodable {
1818 public init ( from decoder: any Decoder ) throws {
1919 let container = try decoder. container ( keyedBy: Self . CodingKeys. self)
2020 if try container. decode ( ResponseMessageType . self, forKey: . type) != . GQL_CONNECTION_ACK {
21- throw DecodingError . dataCorrupted ( . init(
22- codingPath: decoder. codingPath,
23- debugDescription: " type must be ` \( ResponseMessageType . GQL_CONNECTION_ACK. type) ` "
24- ) )
21+ throw DecodingError . dataCorrupted (
22+ . init(
23+ codingPath: decoder. codingPath,
24+ debugDescription:
25+ " type must be ` \( ResponseMessageType . GQL_CONNECTION_ACK. type) ` "
26+ )
27+ )
2528 }
2629 payload = try container. decodeIfPresent ( [ String : Map ] . self, forKey: . payload)
2730 }
@@ -39,10 +42,13 @@ public struct ConnectionErrorResponse: Equatable, JsonEncodable {
3942 public init ( from decoder: any Decoder ) throws {
4043 let container = try decoder. container ( keyedBy: Self . CodingKeys. self)
4144 if try container. decode ( ResponseMessageType . self, forKey: . type) != . GQL_CONNECTION_ERROR {
42- throw DecodingError . dataCorrupted ( . init(
43- codingPath: decoder. codingPath,
44- debugDescription: " type must be ` \( ResponseMessageType . GQL_CONNECTION_ERROR. type) ` "
45- ) )
45+ throw DecodingError . dataCorrupted (
46+ . init(
47+ codingPath: decoder. codingPath,
48+ debugDescription:
49+ " type must be ` \( ResponseMessageType . GQL_CONNECTION_ERROR. type) ` "
50+ )
51+ )
4652 }
4753 payload = try container. decodeIfPresent ( [ String : Map ] . self, forKey: . payload)
4854 }
@@ -59,11 +65,16 @@ public struct ConnectionKeepAliveResponse: Equatable, JsonEncodable {
5965
6066 public init ( from decoder: any Decoder ) throws {
6167 let container = try decoder. container ( keyedBy: Self . CodingKeys. self)
62- if try container. decode ( ResponseMessageType . self, forKey: . type) != . GQL_CONNECTION_KEEP_ALIVE {
63- throw DecodingError . dataCorrupted ( . init(
64- codingPath: decoder. codingPath,
65- debugDescription: " type must be ` \( ResponseMessageType . GQL_CONNECTION_KEEP_ALIVE. type) ` "
66- ) )
68+ if try container. decode ( ResponseMessageType . self, forKey: . type)
69+ != . GQL_CONNECTION_KEEP_ALIVE
70+ {
71+ throw DecodingError . dataCorrupted (
72+ . init(
73+ codingPath: decoder. codingPath,
74+ debugDescription:
75+ " type must be ` \( ResponseMessageType . GQL_CONNECTION_KEEP_ALIVE. type) ` "
76+ )
77+ )
6778 }
6879 payload = try container. decodeIfPresent ( [ String : Map ] . self, forKey: . payload)
6980 }
@@ -83,10 +94,12 @@ public struct DataResponse: Equatable, JsonEncodable {
8394 public init ( from decoder: any Decoder ) throws {
8495 let container = try decoder. container ( keyedBy: Self . CodingKeys. self)
8596 if try container. decode ( ResponseMessageType . self, forKey: . type) != . GQL_DATA {
86- throw DecodingError . dataCorrupted ( . init(
87- codingPath: decoder. codingPath,
88- debugDescription: " type must be ` \( ResponseMessageType . GQL_DATA. type) ` "
89- ) )
97+ throw DecodingError . dataCorrupted (
98+ . init(
99+ codingPath: decoder. codingPath,
100+ debugDescription: " type must be ` \( ResponseMessageType . GQL_DATA. type) ` "
101+ )
102+ )
90103 }
91104 payload = try container. decodeIfPresent ( GraphQLResult . self, forKey: . payload)
92105 id = try container. decode ( String . self, forKey: . id)
@@ -105,10 +118,12 @@ public struct CompleteResponse: Equatable, JsonEncodable {
105118 public init ( from decoder: any Decoder ) throws {
106119 let container = try decoder. container ( keyedBy: Self . CodingKeys. self)
107120 if try container. decode ( ResponseMessageType . self, forKey: . type) != . GQL_COMPLETE {
108- throw DecodingError . dataCorrupted ( . init(
109- codingPath: decoder. codingPath,
110- debugDescription: " type must be ` \( ResponseMessageType . GQL_COMPLETE. type) ` "
111- ) )
121+ throw DecodingError . dataCorrupted (
122+ . init(
123+ codingPath: decoder. codingPath,
124+ debugDescription: " type must be ` \( ResponseMessageType . GQL_COMPLETE. type) ` "
125+ )
126+ )
112127 }
113128 id = try container. decode ( String . self, forKey: . id)
114129 }
@@ -136,10 +151,12 @@ public struct ErrorResponse: Equatable, JsonEncodable {
136151 public init ( from decoder: any Decoder ) throws {
137152 let container = try decoder. container ( keyedBy: Self . CodingKeys. self)
138153 if try container. decode ( ResponseMessageType . self, forKey: . type) != . GQL_ERROR {
139- throw DecodingError . dataCorrupted ( . init(
140- codingPath: decoder. codingPath,
141- debugDescription: " type must be ` \( ResponseMessageType . GQL_ERROR. type) ` "
142- ) )
154+ throw DecodingError . dataCorrupted (
155+ . init(
156+ codingPath: decoder. codingPath,
157+ debugDescription: " type must be ` \( ResponseMessageType . GQL_ERROR. type) ` "
158+ )
159+ )
143160 }
144161 payload = try container. decode ( [ GraphQLError ] . self, forKey: . payload)
145162 id = try container. decode ( String . self, forKey: . id)
0 commit comments