Open kefahi opened 5 years ago
I figured it out, this was the "old" style that seems to be deprecated now. (I like the simpler old style btw :) )
The change I had to do to the Hello world example to work is the following
require "graphql-crystal"
module Kemal::GraphQL
module RootQuery
include ::GraphQL::ObjectType
extend self
field "hello" { "world" }
end
HELLO_WORLD_SCHEMA = ::GraphQL::Schema.from_schema(
%{
schema {
query: RootQuery
}
type RootQuery {
hello: String
}
}
)
HELLO_WORLD_SCHEMA.query_resolver = RootQuery
end
hey Kefah,
thanks for your help. If you like you could open a pull request to fix the example!
Kefah T. Issa writes:
I figured it out, this was the "old" style that seems to be deprecated now. (I like the simpler old style btw :) )
The change I had to do to the Hello world example is work is the following
require "graphql-crystal" module Kemal::GraphQL module RootQuery include ::GraphQL::ObjectType extend self field "hello" { "world" } end HELLO_WORLD_SCHEMA = ::GraphQL::Schema.from_schema( %{ schema { query: RootQuery } type RootQuery { hello: String } } ) HELLO_WORLD_SCHEMA.query_resolver = RootQuery end
When enabling hello_world_schema the following compiler error is thrown:
The way how that hello world example is written is very nice and good for simple cases. But it seems some maintenance is needed there.