From 0acd427af061b35e613eaa0d80cfc80d1a93faff Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 29 Sep 2015 19:11:56 +0600 Subject: Add message decoder implementation. Restrict the Message module interface to the message types and decoder function. --- src/message.mli | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/message.mli') diff --git a/src/message.mli b/src/message.mli index af92d67..2688b8c 100644 --- a/src/message.mli +++ b/src/message.mli @@ -1,16 +1,14 @@ -type operation = { - method_name: string; - path: string list option; - options: (string * string) list option -} +exception Invalid_operation of string +exception Invalid_message of string + +type operation = + | Set of string list + | Delete of string list + | Show of (string list option) * ((string * string) list option) type message = { session_id: string; - ops: operation list; + ops: operation list } -val operation_to_yojson : operation -> Yojson.Safe.json -val operation_of_yojson : Yojson.Safe.json -> [ `Error of bytes | `Ok of operation ] - -val message_to_yojson : message -> Yojson.Safe.json -val message_of_yojson : Yojson.Safe.json -> [ `Error of bytes | `Ok of message ] +val decode : Yojson.Safe.json -> message -- cgit v1.2.3