Commit d02c9fef authored by Bruno Guillaume's avatar Bruno Guillaume
Browse files

add level in validator

parent 728df82c
...@@ -295,6 +295,7 @@ module Validation = struct ...@@ -295,6 +295,7 @@ module Validation = struct
type item = { type item = {
pattern: string list; pattern: string list;
description: string; description: string;
level: string;
} }
type modul = { type modul = {
...@@ -326,7 +327,11 @@ module Validation = struct ...@@ -326,7 +327,11 @@ module Validation = struct
let description = let description =
try json |> member "description" |> to_string try json |> member "description" |> to_string
with Type_error _ -> "No description" in with Type_error _ -> "No description" in
{ pattern; description } in let level =
try json |> member "level" |> to_string
with Type_error _ -> "No level" in
{ pattern; description; level } in
let title = let title =
try json |> member "title" |> to_string try json |> member "title" |> to_string
...@@ -373,7 +378,8 @@ module Validation = struct ...@@ -373,7 +378,8 @@ module Validation = struct
`Assoc [ `Assoc [
"count", `Int count; "count", `Int count;
"pattern", `List (List.map (fun x -> `String x) item.pattern); "pattern", `List (List.map (fun x -> `String x) item.pattern);
"description", `String item.description "description", `String item.description;
"level", `String item.level
] ]
) modul.items) in ) modul.items) in
`Assoc ["title", `String modul.title; "items", out_items] `Assoc ["title", `String modul.title; "items", out_items]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment