11# Ppx Protocol Conv
22Ppx protocol conv (de)serializers using deriving, which allows for
3- plugable
3+ pluggable
44(de)serializers. [ Api] ( https://andersfugmann.github.io/ppx_protocol_conv ) .
55
6- This page contains an simple overview of functionality provided.
6+ This page contains a simple overview of the provided functionality .
77More information is available in the [ wiki pages] ( https://github.com/andersfugmann/ppx_protocol_conv/wiki )
88
99[ ![ Main workflow] ( https://github.com/andersfugmann/ppx_protocol_conv/actions/workflows/workflow.yml/badge.svg )] ( https://github.com/andersfugmann/ppx_protocol_conv/actions/workflows/workflow.yml )
@@ -20,10 +20,10 @@ The ppx supports the following features:
2020 * records
2121 * recursive and non-recursive types
2222 * variants
23- * polymophic variants
24- * All primitive types (except nativeint)
23+ * polymorphic variants
24+ * all primitive types (including ` nativeint ` )
2525
26- The following drivers exists
26+ The following drivers exist:
2727 * ` Json ` which serializes to ` Yojson.Safe.t `
2828 * ` Jsonm ` which serializes to ` Ezjsonm.value `
2929 * ` Msgpack ` which serializes to ` Msgpck.t `
@@ -52,8 +52,8 @@ val a_to_json: a -> Json.t
5252val a_of_json_exn: Json.t -> a
5353val a_of_json: Json.t -> (a, exn) result
5454
55- val b_to_json: a -> Json.t
56- val b_of_json_exn: Json.t -> a
55+ val b_to_json: b -> Json.t
56+ val b_of_json_exn: Json.t -> b
5757val b_of_json: Json.t -> (b, exn) result
5858```
5959
@@ -65,29 +65,29 @@ Evaluates to
6565[ "x", `Int 42; "Y", `String "really"; "z", `List [ `Int 6; `Int 7 ] ] (* Yojson.Safe.json *)
6666```
6767
68- ` to_protocol ` deriver will generate serilisation of the
69- type. ` of_protocol ` deriver generates de-serilisation of the type,
70- while ` protocol ` deriver will generate both serilisation and de-serilisation functions.
68+ ` to_protocol ` deriver generates serialization of the
69+ type. ` of_protocol ` deriver generates deserialization of the type,
70+ while ` protocol ` deriver generates both serialization and deserialization functions.
7171
7272## Attributes
7373Record label names can be changed using ` [@key <string>] `
7474
7575Variant and polymorphic variant constructors names can be changed using the ` [@name <string>] `
7676attribute.
7777
78- If a record field is not present in the input when deserialising, as default value can be
78+ If a record field is not present in the input when deserializing, a default value can be
7979assigned using ` [@default <expr>] ` . If the value to be serialized
8080matches the default value, the field will be omitted (Some drivers
81- allow disabling this functonality. Comparrison uses polymorphic compare, so be careful.
81+ allow disabling this functionality. Comparison uses polymorphic compare, so be careful.)
8282
8383## Signatures
84- The ppx also handles signature , but disallows
85- ` [@key ...] ` , ` [@default ...] ` and ` [@name] .... ` as these does not impact signatures.
84+ The ppx also handles signatures , but disallows
85+ ` [@key ...] ` , ` [@default ...] ` and ` [@name ...] ` because these do not impact signatures.
8686
8787## Drivers
8888
8989Drivers specify concrete serialization and deserialization.
90- Users of the library can elect to implement their own driver see
90+ Users of the library can elect to implement their own driver, see
9191[ custom drivers] ( #custom-drivers ) , or use predefined drivers:
9292
9393 * ` Json ` which serializes to ` Yojson.Safe.t `
@@ -104,10 +104,12 @@ It is easy to provide custom drivers by implementing the signature:
104104include Protocol_conv.Runtime.Driver with
105105 type t = ...
106106```
107- See the ` drivers ` directory for examples on how to implemented new drivers.
107+ See the ` drivers ` directory for examples on how to implement new drivers.
108108Submissions of new drivers are more than welcome.
109109
110110## Not supported
111111* Generalised algebraic datatypes
112112* Extensible types
113113* Extensible polymorphic variants
114+
115+ Unsupported type shapes are reported with location-aware PPX errors.
0 commit comments