Skip to content

Instantly share code, notes, and snippets.

@epk
Created April 30, 2019 20:32
Show Gist options
  • Save epk/2a217f39394426284699ef6ff26b1a06 to your computer and use it in GitHub Desktop.
Save epk/2a217f39394426284699ef6ff26b1a06 to your computer and use it in GitHub Desktop.
false
Int!
true
true
false
Int!
false
ID!
true
Running go vet ./... in /var/folders/7c/qpccms_j3v38zgnhczjy8f5c0000gn/T/d20190430-5777-1tvi8re/queries
.true
.false
ID!
false
Shop!
Running go vet ./... in /var/folders/7c/qpccms_j3v38zgnhczjy8f5c0000gn/T/d20190430-5777-1efdlli/queries
..false
ID!
false
Shop!
.false
ID!
false
Shop!
.false
Int!
false
Int!
true
false
Int!
true
Running go vet ./... in /var/folders/7c/qpccms_j3v38zgnhczjy8f5c0000gn/T/d20190430-5777-bghu7m/queries
.false
ID!
false
Shop!
Running go vet ./... in /var/folders/7c/qpccms_j3v38zgnhczjy8f5c0000gn/T/d20190430-5777-1i92o8j/queries
.false
Int!
true
true
true
true
true
false
Shop!
.true
true
true
true
Running go vet ./... in /var/folders/7c/qpccms_j3v38zgnhczjy8f5c0000gn/T/d20190430-5777-2s3s9w/queries
.false
ID!
false
Shop!
false
ID!
false
Shop!
Running go vet ./... in /var/folders/7c/qpccms_j3v38zgnhczjy8f5c0000gn/T/d20190430-5777-1y5parg/queries
.false
ID!
false
Shop!
.false
Int!
true
true
true
true
true
false
Shop!
Running go vet ./... in /var/folders/7c/qpccms_j3v38zgnhczjy8f5c0000gn/T/d20190430-5777-1fjsqub/queries
.false
Int!
true
true
true
false
String!
true
true
true
true
false
Int!
true
false
Int!
false
Int!
true
false
Int!
true
Running go vet ./... in /var/folders/7c/qpccms_j3v38zgnhczjy8f5c0000gn/T/d20190430-5777-1plp0ce/queries
true
false
ClusterRestrictions!
true
true
def self.nullable_field_data(gql_type)
non_null = if gql_type.list?
child = gql_type.of_type
if child.list? && !child.non_null?
child = child.of_type
end
child.non_null?
else
gql_type.non_null?
end
verify(gql_type, non_null)
{
nullable: !non_null,
list: gql_type.list?,
list_nullable: gql_type.list? && !gql_type.non_null?,
}
end
def self.verify(gql_type, non_nullable)
non_null = case gql_type
when GraphQL::NonNullType
child_type = gql_type.of_type
if child_type.list?
child_type.of_type.non_null?
else
child_type.non_null?
end
when GraphQL::ListType
gql_type.of_type.non_null?
else
gql_type.non_null?
end
puts non_nullable == non_null
puts gql_type if non_nullable != non_null
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment