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
Copy file name to clipboardExpand all lines: docs/HOW_TO_MODEL_A_BASIC_RECORD.md
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,10 @@ type Person = { Id: int; Name: string }
9
9
let makePerson id name = { Id = id; Name = name }
10
10
11
11
let codec =
12
-
Schema.define<Person>
13
-
|> Schema.construct makePerson
12
+
Schema.record makePerson
14
13
|> Schema.field "id" _.Id
15
14
|> Schema.field "name" _.Name
16
15
|> Json.buildAndCompile
17
16
```
18
17
19
-
This is the smallest authored schema shape: define the record target, provide the constructor, then map each field explicitly and finish with `Json.buildAndCompile`.
18
+
This is the smallest authored schema shape: start the record with its constructor, then map each field explicitly and finish with `Json.buildAndCompile`.
0 commit comments