Skip to content

Instantly share code, notes, and snippets.

@github0013
Last active May 5, 2017 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save github0013/2bd68d7569d49533ab629ca05f3f8238 to your computer and use it in GitHub Desktop.
Save github0013/2bd68d7569d49533ab629ca05f3f8238 to your computer and use it in GitHub Desktop.
apollo doesn't return values nor error when [Episode]! type has null value
module Types
Level1Type = GraphQL::ObjectType.define do
name "Level1Type"
field :name, types.String
end
ArrayWithNullValueType = GraphQL::ObjectType.define do
name "ArrayWithNullValueType"
field :level1s, !types[Level1Type]
end
end
module Types
QueryType = GraphQL::ObjectType.define do
name "Query"
field :ArrayWithNullValue do
type !ArrayWithNullValueType
resolve ->(obj, args, ctx) {
level1s = [
nil,
OpenStruct.new(name: "some name1"),
OpenStruct.new(name: "some name2")
]
OpenStruct.new(level1s: level1s)
}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment