Skip to content

Commit

Permalink
Implement schema parsing and extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
rmosolgo committed Dec 8, 2023
1 parent b7381a3 commit 4f6e18b
Show file tree
Hide file tree
Showing 3 changed files with 346 additions and 38 deletions.
28 changes: 16 additions & 12 deletions lib/graphql/language/printer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,16 @@ def print_union_type_definition(union_type, extension: false)
print_string("union ")
print_string(union_type.name)
print_directives(union_type.directives)
print_string(" = ")
i = 0
union_type.types.each do |t|
if i > 0
print_string(" | ")
if union_type.types.any?
print_string(" = ")
i = 0
union_type.types.each do |t|
if i > 0
print_string(" | ")
end
print_string(t.name)
i += 1
end
print_string(t.name)
i += 1
end
end

Expand All @@ -353,12 +355,14 @@ def print_enum_type_definition(enum_type, extension: false)
print_string("enum ")
print_string(enum_type.name)
print_directives(enum_type.directives)
print_string(" {\n")
enum_type.values.each.with_index do |value, i|
print_description(value, indent: " ", first_in_block: i == 0)
print_enum_value_definition(value)
if enum_type.values.any?
print_string(" {\n")
enum_type.values.each.with_index do |value, i|
print_description(value, indent: " ", first_in_block: i == 0)
print_enum_value_definition(value)
end
print_string("}")
end
print_string("}")
end

def print_enum_value_definition(enum_value)
Expand Down
Loading

0 comments on commit 4f6e18b

Please sign in to comment.