Skip to content

Commit a9b06e4

Browse files
committed
Use map description instead of JSON encoding for argument default values.
1 parent 9f1bf4a commit a9b06e4

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

Sources/GraphQL/Type/Definition.swift

+2-16
Original file line numberDiff line numberDiff line change
@@ -678,14 +678,7 @@ public struct GraphQLArgumentDefinition {
678678
) {
679679
self.name = name
680680
self.type = type
681-
682-
self.defaultValue = try? defaultValue.flatMap {
683-
String(
684-
data: try JSONEncoder().encode($0),
685-
encoding: .utf8
686-
)
687-
}
688-
681+
self.defaultValue = defaultValue?.description
689682
self.description = description
690683
}
691684
}
@@ -1266,14 +1259,7 @@ public struct InputObjectField {
12661259

12671260
public init(type: GraphQLInputType, defaultValue: Map? = nil, description: String? = nil) {
12681261
self.type = type
1269-
1270-
self.defaultValue = try? defaultValue.flatMap {
1271-
String(
1272-
data: try JSONEncoder().encode($0),
1273-
encoding: .utf8
1274-
)
1275-
}
1276-
1262+
self.defaultValue = defaultValue?.description
12771263
self.description = description
12781264
}
12791265
}

0 commit comments

Comments
 (0)