Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Yojson t types instead of deprecated json #208

Merged
merged 3 commits into from
Jul 4, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use Yojson t types instead of deprecated json
This fixes compatibility for Yojson 2 while still working with Yojson >=
1.6
Leonidas-from-XIV committed Jun 14, 2022
commit 8f09cd048c5ed8fdf6d5dbbc3c63a5d4ab2dde14
2 changes: 1 addition & 1 deletion graphql.opam
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ depends: [
"ocaml" {>= "4.03.0"}
"dune" {>= "1.1"}
"graphql_parser" {>= "0.9.0"}
"yojson"
"yojson" {>= "1.6.0"}
"rresult"
"seq"
"alcotest" {with-test}
30 changes: 15 additions & 15 deletions graphql/src/graphql_intf.ml
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ module type Field_error = sig
val message_of_field_error : t -> string

val extensions_of_field_error :
t -> ((string * Yojson.Basic.json)[@warning "-3"]) list option
t -> (string * Yojson.Basic.t) list option
end

(** GraphQL schema signature *)
@@ -188,10 +188,10 @@ module type Schema = sig
?doc:string -> string -> values:'a enum_value list -> ('ctx, 'a option) typ

val scalar :
(?doc:string ->
string ->
coerce:('a -> Yojson.Basic.json) ->
('ctx, 'a option) typ[@warning "-3"])
?doc:string ->
string ->
coerce:('a -> Yojson.Basic.t) ->
('ctx, 'a option) typ

val list : ('ctx, 'src) typ -> ('ctx, 'src list option) typ

@@ -251,18 +251,18 @@ module type Schema = sig

type variables = (string * Graphql_parser.const_value) list

type 'a response = (('a, Yojson.Basic.json) result[@warning "-3"])
type 'a response = ('a, Yojson.Basic.t) result

val execute :
('ctx schema ->
'ctx ->
?variables:variables ->
?operation_name:string ->
Graphql_parser.document ->
[ `Response of Yojson.Basic.json
| `Stream of Yojson.Basic.json response Io.Stream.t ]
response
Io.t[@warning "-3"])
'ctx schema ->
'ctx ->
?variables:variables ->
?operation_name:string ->
Graphql_parser.document ->
[ `Response of Yojson.Basic.t
| `Stream of Yojson.Basic.t response Io.Stream.t ]
response
Io.t
(** [execute schema ctx variables doc] evaluates the [doc] against [schema]
with the given context [ctx] and [variables]. *)
end
4 changes: 2 additions & 2 deletions graphql/src/graphql_schema.ml
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ module type Field_error = sig
val message_of_field_error : t -> string

val extensions_of_field_error :
t -> ((string * Yojson.Basic.json)[@warning "-3"]) list option
t -> (string * Yojson.Basic.t) list option
end

(* Schema *)
@@ -122,7 +122,7 @@ module Make (Io : IO) (Field_error : Field_error) = struct
value : 'a;
}

type json = (Yojson.Basic.json[@warning "-3"])
type json = Yojson.Basic.t

let enum_value ?doc ?(deprecated = NotDeprecated) name ~value =
{ name; doc; deprecated; value }