Skip to content

Commit 0b44696

Browse files
authored
Merge pull request #3 from cdaringe/refactor/casing
refactor/casing
2 parents 2c5fe75 + 174f029 commit 0b44696

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ gleam add gserde
1212

1313
## usage
1414

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!
1819

1920
```gleam
2021
// src/foo.gleam
2122
import gleam/option.{type Option}
22-
pub type FooJSON {
23+
pub type FooJson {
2324
Foo(
2425
a_bool: Bool,
2526
b_int: Int,

src/gserde.gleam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub fn process_single(src_filename: String) {
6868

6969
let custom_types =
7070
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") })
7272
let requests =
7373
custom_types
7474
|> list.flat_map(fn(custom_type) {

test/gserde_test.gleam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn main() {
1010
}
1111

1212
const foo_module = "import gleam/option.{type Option}
13-
pub type FooJSON {
13+
pub type FooJson {
1414
Foo(
1515
a_bool: Bool,
1616
b_int: Int,

0 commit comments

Comments
 (0)