From b05e2d2be7be28ee6c577671002797cf9abaf177 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Fri, 20 Nov 2026 16:23:53 +0100 Subject: New module for working with Values --- lib/query/encoder.ml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'lib/query/encoder.ml') diff --git a/lib/query/encoder.ml b/lib/query/encoder.ml index ba5435e..64464fd 100644 --- a/lib/query/encoder.ml +++ b/lib/query/encoder.ml @@ -291,7 +291,7 @@ module DataToCaqtiValues = Map (struct include DefaultEncoder type 'a t = 'a - type env = string -> Model.value + type env = string -> Value.value let f : type a. env -> a Intf.data -> a t = fun provider Intf.{ name; content_type } -> @@ -299,13 +299,15 @@ module DataToCaqtiValues = Map (struct (* Check the value given by the provider and ensure it’s match the expected type *) match result with - | Model.Typ.Seq _ -> raise TypeMismatch - | Model.Typ.None -> - (* The provider does not have any value for this property, use the - default value*) - Model.Typ.default_value content_type - | Model.Typ.V (field_type', value) -> ( - match Model.Typ.eq content_type field_type' with - | Some Equal -> value - | None -> raise TypeMismatch) + | Value.Data.Any d -> ( + match d with + | Value.Data.Seq _ -> raise TypeMismatch + | Value.Data.None -> + (* The provider does not have any value for this property, use the + default value*) + Model.Typ.default_value content_type + | Value.Data.V (field_type', value) -> ( + match Model.Typ.eq content_type field_type' with + | Some Equal -> value + | None -> raise TypeMismatch)) end) -- cgit v1.2.3