• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MinaProtocol / mina / 2863

05 Nov 2024 06:20PM UTC coverage: 30.754% (-16.6%) from 47.311%
2863

push

buildkite

web-flow
Merge pull request #16296 from MinaProtocol/dkijania/more_multi_jobs

more multi jobs in CI

20276 of 65930 relevant lines covered (30.75%)

8631.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

41.67
/src/lib/graphql_basic_scalars/utils.ml
1
(**
2
   Utility functors to build custom graphql scalars.  These functors
3
   parametric in the GraphQL Schema module, so that we can use them
4
   either with the async version (for the main application) or the
5
   pure version (for tests).  *)
6

2✔
7
module type Schema = sig
8
  type ('a, 'b) typ
9

10
  val scalar :
11
       ?doc:string
12
    -> string
13
    -> coerce:('a -> Yojson.Basic.t)
14
    -> ('ctx, 'a option) typ
15

16
  val string : ('ctx, string option) typ
17
end
18

19
module type Json_intf_any_typ = sig
20
  type t
21

22
  type ('a, 'b) typ
23

24
  val parse : Yojson.Basic.t -> t
25

26
  val serialize : t -> Yojson.Basic.t
27

28
  val typ : unit -> ('a, t option) typ
29
end
30

31
module Make_scalar_using_to_string (T : sig
32
  type t
33

34
  val to_string : t -> string
35

36
  val of_string : string -> t
37
end) (Scalar : sig
38
  val name : string
39

40
  val doc : string
41
end)
42
(Schema : Schema) :
43
  Json_intf_any_typ
44
    with type ('a, 'b) typ := ('a, 'b) Schema.typ
45
    with type t = T.t = struct
46
  type t = T.t
47

48
  let parse json = Yojson.Basic.Util.to_string json |> T.of_string
×
49

50
  let serialize x = `String (T.to_string x)
×
51

52
  let typ () = Schema.scalar Scalar.name ~doc:Scalar.doc ~coerce:serialize
11✔
53
end
54

55
module Make_scalar_using_base58_check (T : sig
56
  type t
57

58
  val to_base58_check : t -> string
59

60
  val of_base58_check_exn : string -> t
61
end) (Scalar : sig
62
  val name : string
63

64
  val doc : string
65
end)
66
(Schema : Schema) :
67
  Json_intf_any_typ
68
    with type ('a, 'b) typ := ('a, 'b) Schema.typ
69
    with type t = T.t = struct
70
  type t = T.t
71

72
  let parse json = Yojson.Basic.Util.to_string json |> T.of_base58_check_exn
×
73

74
  let serialize x = `String (T.to_base58_check x)
×
75

76
  let typ () = Schema.scalar Scalar.name ~doc:Scalar.doc ~coerce:serialize
5✔
77
end
78

79
module Make_scalar_using_base64 (T : sig
80
  type t
81

82
  val to_base64 : t -> string
83

84
  val of_base64 : string -> t Core_kernel.Or_error.t
85
end) (Scalar : sig
86
  val name : string
87

88
  val doc : string
89
end)
90
(Schema : Schema) :
91
  Json_intf_any_typ
92
    with type ('a, 'b) typ := ('a, 'b) Schema.typ
93
    with type t = T.t = struct
94
  type t = T.t
95

96
  let parse json =
97
    Yojson.Basic.Util.to_string json
×
98
    |> T.of_base64 |> Core_kernel.Or_error.ok_exn
×
99

100
  let serialize x = `String (T.to_base64 x)
×
101

102
  let typ () = Schema.scalar Scalar.name ~doc:Scalar.doc ~coerce:serialize
1✔
103
end
104

105
(** The async schema *)
106
module Schema = Graphql_wrapper.Make (Graphql_async.Schema)
107

108
(** The schema for non async tests *)
109
module Test_schema = Graphql.Schema
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc