You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This package doesn't take care of running atdgen to derive code from
15
-
type definitions. This step requires the `atdgen` binary which can be
16
-
obtained using [opam](https://opam.ocaml.org/) or [esy](https://esy.sh/).
14
+
This package doesn't take care of running `atdgen` to derive code from type definitions. For that, you need to [`rescript-atdgen-generator`](https://github.com/TheSpyder/rescript-atdgen-generator) to generate the `.ml` and `.mli` files from `.atd` sources.
17
15
18
-
Alternatively, if your project is using BuckleScript exclusively (i.e. not using native OCaml or Reason in the backend),
19
-
you might consider using [`bs-atdgen-generator`](https://github.com/jchavarri/bs-atdgen-generator) in combination with
20
-
this runtime library, in order to generate the `.ml` and `.mli` files from `.atd` sources without having to use native
21
-
package managers like `esy` or `opam`.
16
+
## A note about ReScript 11
17
+
The `atd` code-generation project is an OCaml tool, and generates OCaml files. As such it does not support uncurried mode. The ahrefs team is open to a contribution that generates ReScript instead, but so long as this project only has one user that doesn't seem worth the effort. For more information and to add your voice to the discussion please follow the github issue (TODO).
22
18
23
19
## Usage
24
20
25
-
Add `@ahrefs/bs-atdgen-codec-runtime` to the `bs-dependencies` of
26
-
`bsconfig.json`.
21
+
Add `rescript-atdgen-generator` to the `bs-dependencies` of `bsconfig.json`.
27
22
28
-
To write atd type definitions, please have a look at the [great atd
To write atd type definitions, please have a look at the [atd documentation](https://atd.readthedocs.io/en/latest/).
30
24
31
25
## Simple example
32
26
33
-
Reason code to query and deserialize the response of a REST API. It
34
-
requires `bs-fetch`.
27
+
Reason code to query and deserialize the response of a REST API using the `meetup.atd` file in `example/src`. It requires `bs-fetch`.
28
+
29
+
(TODO: rewrite in ReScript with either rescript-webapi or rescript-fetch)
35
30
36
31
```
37
32
let get = (url, decode) =>
@@ -53,9 +48,12 @@ let v: Meetup_t.events =
53
48
54
49
## Full example
55
50
56
-
The [example](example) directory contains a full example of a simple
57
-
cli to read and write data in a JSON file.
51
+
The [example](example) directory contains a full example of a simple cli to read and write data in a JSON file.
52
+
53
+
For a complete introduction from atdgen installation to json manipulation, please refer to [Getting started with atdgen and melange](https://tech.ahrefs.com/getting-started-with-atdgen-and-bucklescript-1f3a14004081). The article talks about melange a lot, which isn't relevant, but it does still serve as a good introduction to `atd` syntax.
54
+
55
+
## License and Credits
56
+
57
+
All code is licensed as MIT. See [LICENSE](LICENSE).
58
58
59
-
For a complete introduction from atdgen installation to json
60
-
manipulation, please refer to [Getting started with atdgen and
This project was forked from [@ahrefs/bs-atdgen-codec-runtime](https://github.com/ahrefs/bs-atdgen-codec-runtime). That project has now migrated to melange, I made a copy of the commit I forked from [here](https://github.com/thespyder/bs-atdgen-codec-runtime).
0 commit comments