Skip to content
Snippets Groups Projects
Commit f865e83a authored by Alexis Kalderimis's avatar Alexis Kalderimis :speech_balloon:
Browse files

Use kind predicates

parent 59bcb7b0
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -47,7 +47,7 @@ def serialize_field_selection(hash, level = 0)
NO_SKIP = ->(_name, _field) { false }
 
def self.select_fields(type, skip = NO_SKIP, parent_types = Set.new, max_depth = 3)
return new if max_depth <= 0 || !type.respond_to?(:fields) # could be a union!
return new if max_depth <= 0 || !type.kind.fields?
 
new(type.fields.flat_map do |name, field|
next [] if skip[name, field]
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment