File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,15 @@ gleam add gserde
12
12
13
13
## usage
14
14
15
- 1 . Create custom type with a singular variant constructor:
16
- 2 . Run ` gleam run -m gserde `
17
- 3 . Observe ` src/foo_json.gleam ` , which has the goodies you need for json (de)serialization.
15
+ 1 . Create custom type with a singular variant constructor. See the example ` src/foo.gleam ` below.
16
+ 2 . Run ` gleam run -m gserde ` .
17
+ 3 . Observe the generated file ` src/foo_json.gleam ` .
18
+ 4 . Use it!
18
19
19
20
``` gleam
20
21
// src/foo.gleam
21
22
import gleam/option.{type Option}
22
- pub type FooJSON {
23
+ pub type FooJson {
23
24
Foo(
24
25
a_bool: Bool,
25
26
b_int: Int,
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ pub fn process_single(src_filename: String) {
68
68
69
69
let custom_types =
70
70
list . map ( parsed . custom_types , fn ( def ) { def . definition } )
71
- |> list . filter ( fn ( x ) { string . ends_with ( x . name , "JSON " ) } )
71
+ |> list . filter ( fn ( x ) { string . ends_with ( x . name , "Json " ) } )
72
72
let requests =
73
73
custom_types
74
74
|> list . flat_map ( fn ( custom_type ) {
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pub fn main() {
10
10
}
11
11
12
12
const foo_module = "import gleam/option.{type Option}
13
- pub type FooJSON {
13
+ pub type FooJson {
14
14
Foo(
15
15
a_bool: Bool,
16
16
b_int: Int,
You can’t perform that action at this time.
0 commit comments