这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions codegen/lib/graphql_java_gen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,13 @@ def generate_build_input_code(expr, type, depth: 1)
item_type = type.of_type
<<-JAVA
_queryBuilder.append('[');

String listSeperator#{depth} = "";
for (#{java_input_type(item_type)} item#{depth} : #{expr}) {
_queryBuilder.append(listSeperator#{depth});
listSeperator#{depth} = ",";
#{generate_build_input_code("item#{depth}", item_type, depth: depth + 1)}
{
String listSeperator#{depth} = "";
for (#{java_input_type(item_type)} item#{depth} : #{expr}) {
_queryBuilder.append(listSeperator#{depth});
listSeperator#{depth} = ",";
#{generate_build_input_code("item#{depth}", item_type, depth: depth + 1)}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it. Did you just add a scope to the block?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it was being called again in Input.java.erb for the optional fields but had no context to resume the previous depth count. Just added a block so it can safely start at 1 again for new fields.

}
_queryBuilder.append(']');
JAVA
Expand Down