Skip to content

Commit 5014d9b

Browse files
mmiller-maxcaptchanjack
authored andcommitted
Fix get_output_fields when Dict has more than one key
1 parent 2718033 commit 5014d9b

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "GraphQLClient"
22
uuid = "09d831e3-9c21-47a9-bfd8-076871817219"
3-
version = "0.7.1"
3+
version = "0.7.2"
44

55
[deps]
66
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"

src/output_fields.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ get_output_str(output::Alias) = "$output,"
124124
function get_output_str(output::Dict)
125125
str = ""
126126
for (key, val) in output
127-
str = "$key{"
127+
str *= "$key{"
128128
str *= get_output_str(val)
129129
str *= "},"
130130
end

test/output_fields.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,26 @@ end
148148
client.query_to_type_map[query_name] = "MyRecursiveType"
149149
@test GraphQLClient.get_all_output_fields_str(client, query_name, []) == "field1,"
150150
@test_logs (:warn, Regex("Can't query all output fields due to recursion of these object\\(s\\):")) GraphQLClient.get_all_output_fields_str(client, query_name, [])
151+
end
152+
153+
@testset "issue #7" begin
154+
output_fields=[
155+
Dict(
156+
"level1" =>Dict(
157+
"level2" => Dict(
158+
"level3" => Dict(
159+
"level4_1" => [
160+
"level4_1_1",
161+
],
162+
"level4_2" => [
163+
"level4_2_1",
164+
],
165+
)
166+
)
167+
)
168+
)
169+
]
170+
output_str = GraphQLClient.get_output_str(output_fields)
171+
@test occursin("level4_1{level4_1_1,}" , output_str)
172+
@test occursin("level4_2{level4_2_1,}" , output_str)
151173
end

0 commit comments

Comments
 (0)