From 06f72b427585bfe9ab1c77bfbd71cb9fa6f3e3bc Mon Sep 17 00:00:00 2001 From: zach Date: Wed, 30 Mar 2022 11:16:22 -0700 Subject: [PATCH 1/3] Fix Websocket conflict --- graphql-cohttp/src/graphql_cohttp.ml | 2 +- .../src/{websocket.ml => graphql_websocket.ml} | 0 .../src/{websocket.mli => graphql_websocket.mli} | 0 graphql-cohttp/src/websocket_handler.ml | 12 ++++++------ 4 files changed, 7 insertions(+), 7 deletions(-) rename graphql-cohttp/src/{websocket.ml => graphql_websocket.ml} (100%) rename graphql-cohttp/src/{websocket.mli => graphql_websocket.mli} (100%) diff --git a/graphql-cohttp/src/graphql_cohttp.ml b/graphql-cohttp/src/graphql_cohttp.ml index ce43f61..a4d18ab 100644 --- a/graphql-cohttp/src/graphql_cohttp.ml +++ b/graphql-cohttp/src/graphql_cohttp.ml @@ -113,7 +113,7 @@ module Make (Io : Cohttp.S.IO with type 'a t = 'a Schema.Io.t) (Body : HttpBody with type +'a io := 'a Schema.Io.t) = struct - module Ws = Websocket.Connection.Make (Io) + module Ws = Graphql_websocket.Connection.Make (Io) module Websocket_transport = Websocket_handler.Make (Schema.Io) (Ws) let ( >>= ) = Io.( >>= ) diff --git a/graphql-cohttp/src/websocket.ml b/graphql-cohttp/src/graphql_websocket.ml similarity index 100% rename from graphql-cohttp/src/websocket.ml rename to graphql-cohttp/src/graphql_websocket.ml diff --git a/graphql-cohttp/src/websocket.mli b/graphql-cohttp/src/graphql_websocket.mli similarity index 100% rename from graphql-cohttp/src/websocket.mli rename to graphql-cohttp/src/graphql_websocket.mli diff --git a/graphql-cohttp/src/websocket_handler.ml b/graphql-cohttp/src/websocket_handler.ml index 15c57cb..43216c8 100644 --- a/graphql-cohttp/src/websocket_handler.ml +++ b/graphql-cohttp/src/websocket_handler.ml @@ -1,6 +1,6 @@ module Make (IO : Graphql_intf.IO) - (Ws : Websocket.Connection.S with type 'a IO.t = 'a IO.t) = + (Ws : Graphql_websocket.Connection.S with type 'a IO.t = 'a IO.t) = struct module Json = Yojson.Basic.Util @@ -61,7 +61,7 @@ struct (* | Gql_connection_keep_alive -> "ka" *) - let create_message ?(opcode = Websocket.Frame.Opcode.Text) ?id + let create_message ?(opcode = Graphql_websocket.Frame.Opcode.Text) ?id ?(payload = `Null) typ = let frame_payload = `Assoc @@ -72,13 +72,13 @@ struct ] in let content = Yojson.Basic.to_string frame_payload in - Websocket.Frame.create ~opcode ~content () + Graphql_websocket.Frame.create ~opcode ~content () let handle_frame t ~execute_query frame = - match frame.Websocket.Frame.opcode with + match frame.Graphql_websocket.Frame.opcode with | Ping | Pong | Close | Ctrl _ | Nonctrl _ -> IO.return () | Continuation | Text | Binary -> ( - let json = Yojson.Basic.from_string frame.Websocket.Frame.content in + let json = Yojson.Basic.from_string frame.Graphql_websocket.Frame.content in match client_message_of_payload json with | Ok Gql_connection_init -> Ws.send t.conn (create_message Gql_connection_ack) @@ -106,7 +106,7 @@ struct | Ok Gql_connection_terminate -> Hashtbl.iter (fun _id close -> close ()) t.subscriptions; Ws.send t.conn - (create_message ~opcode:Websocket.Frame.Opcode.Close + (create_message ~opcode:Graphql_websocket.Frame.Opcode.Close Gql_connection_error) | Error msg -> let id = Json.(json |> member "id" |> to_string) in From c1cf474827d4821a784d4fcfa9a4ff67bcb65d02 Mon Sep 17 00:00:00 2001 From: zach Date: Wed, 30 Mar 2022 11:16:35 -0700 Subject: [PATCH 2/3] Update deprecated Fmt functions --- graphql_parser/src/ast.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphql_parser/src/ast.ml b/graphql_parser/src/ast.ml index b17ee0b..ae41a9c 100644 --- a/graphql_parser/src/ast.ml +++ b/graphql_parser/src/ast.ml @@ -138,7 +138,7 @@ module Pp = struct and selection_set fmt = omit_empty_list - Fmt.(braces (hvbox ~indent:2 (prefix cut (list pp_selection)))) + Fmt.(braces (hvbox ~indent:2 (cut ++ (list pp_selection)))) fmt let rec pp_typ fmt = function From b1d3528360fa4c03082f77c40a1b5785553e7497 Mon Sep 17 00:00:00 2001 From: zach Date: Wed, 30 Mar 2022 14:40:21 -0700 Subject: [PATCH 3/3] Use Core instead of Core_kernel --- graphql-async/test/async_test.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphql-async/test/async_test.ml b/graphql-async/test/async_test.ml index fc10679..dd2a873 100644 --- a/graphql-async/test/async_test.ml +++ b/graphql-async/test/async_test.ml @@ -23,7 +23,7 @@ let test_query schema ctx query expected = | Ok (`Stream stream) -> Async_kernel.Pipe.to_list stream >>| fun lst -> `List - Core_kernel.( + Core.( List.map lst ~f:(fun x -> Option.value_exn (Result.ok x))) | Error err -> Async_kernel.return err) >>| fun result ->