From 2157ffb8298afe8a5d1d0bdf71d2ad256c90fceb Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Tue, 26 Oct 2021 23:02:08 -0400 Subject: Initial json parsing and validation --- lib/listenbrainz_util.ml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 lib/listenbrainz_util.ml (limited to 'lib/listenbrainz_util.ml') diff --git a/lib/listenbrainz_util.ml b/lib/listenbrainz_util.ml new file mode 100644 index 0000000..35a7af8 --- /dev/null +++ b/lib/listenbrainz_util.ml @@ -0,0 +1,9 @@ +open Listenbrainz_t + +let validate_submission s = + match s.listen_type with + | `Single -> List.length s.payload = 1 + | _ -> true + +let validate_response r = + List.length r.listens = r.count -- cgit v1.2.3