From 6365762ae848dc4022b04884cb0c201bbcc7368d Mon Sep 17 00:00:00 2001 From: Timo Netzer Date: Sat, 28 Dec 2024 23:13:21 +0100 Subject: [PATCH 1/2] fix i-graphql example --- example/i-graphql/graphql.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/example/i-graphql/graphql.ml b/example/i-graphql/graphql.ml index 45d52d82..823d69a8 100644 --- a/example/i-graphql/graphql.ml +++ b/example/i-graphql/graphql.ml @@ -5,7 +5,7 @@ let hardcoded_users = [ {id = 2; name = "bob"}; ] -let user = +let user () = Graphql_lwt.Schema.(obj "user" ~fields:[ field "id" @@ -18,10 +18,10 @@ let user = ~resolve:(fun _info user -> user.name); ]) -let schema = +let schema () = Graphql_lwt.Schema.(schema [ field "users" - ~typ:(non_null (list (non_null user))) + ~typ:(non_null (list (non_null (user ())))) ~args:Arg.[arg "id" ~typ:int] ~resolve:(fun _info () id -> match id with @@ -40,6 +40,6 @@ let () = @@ Dream.logger @@ Dream.origin_referrer_check @@ Dream.router [ - Dream.any "/graphql" (Dream.graphql Lwt.return schema); + Dream.any "/graphql" (Dream.graphql Lwt.return (schema ())); Dream.get "/" (Dream.graphiql ~default_query "/graphql"); ] From eb5d7d2decee276c04ee75242bce149b793a5c33 Mon Sep 17 00:00:00 2001 From: Sebastian Willenbrink Date: Fri, 16 Jan 2026 15:56:59 +0100 Subject: [PATCH 2/2] Keep graphql.ml and README.md in sync --- example/i-graphql/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/example/i-graphql/README.md b/example/i-graphql/README.md index 45c7bcdb..4d44d892 100644 --- a/example/i-graphql/README.md +++ b/example/i-graphql/README.md @@ -17,7 +17,7 @@ let hardcoded_users = [ {id = 2; name = "bob"}; ] -let user = +let user () = Graphql_lwt.Schema.(obj "user" ~fields:[ field "id" @@ -30,10 +30,10 @@ let user = ~resolve:(fun _info user -> user.name); ]) -let schema = +let schema () = Graphql_lwt.Schema.(schema [ field "users" - ~typ:(non_null (list (non_null user))) + ~typ:(non_null (list (non_null (user ())))) ~args:Arg.[arg "id" ~typ:int] ~resolve:(fun _info () id -> match id with @@ -52,7 +52,7 @@ let () = @@ Dream.logger @@ Dream.origin_referrer_check @@ Dream.router [ - Dream.any "/graphql" (Dream.graphql Lwt.return schema); + Dream.any "/graphql" (Dream.graphql Lwt.return (schema ())); Dream.get "/" (Dream.graphiql ~default_query "/graphql"); ] ```