Skip to content

Commit 0534fd1

Browse files
Update README.md
1 parent f238a54 commit 0534fd1

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,31 @@ encodePoint point =
168168
which contains an Elm type for the `color` and `point` definitions along with
169169
their corresponding JSON decoders and encoders.
170170

171-
Furthermore, if we supply `js2e` with another JSON schema file that references
172-
any of the definitions in `definitions.json`, e.g.
171+
Furthermore, if we instead supply `js2e` with a directory of JSON schema files
172+
that have references across files, e.g.
173173

174174
``` json
175-
{ "$ref" : "http://example.com/definitions.json#point" }
175+
{
176+
"$schema": "http://json-schema.org/draft-04/schema",
177+
"title": "Circle",
178+
"id": "http://example.com/circle.json",
179+
"description": "Schema for a circle shape",
180+
"type": "object",
181+
"properties": {
182+
"center": {
183+
"$ref": "http://example.com/definitions.json#point"
184+
},
185+
"radius": {
186+
"type": "number"
187+
},
188+
"color": {
189+
"$ref": "http://example.com/definitions.json#color"
190+
}
191+
},
192+
"required": ["center", "radius"]
193+
}
176194
```
177195

178-
then the corresponding Elm file output will import the definitions `Point`,
179-
`pointDecoder` and `encodePoint` from `Domain.Definitions`.
196+
then the corresponding Elm file, `Domain.Circle`, will import the
197+
definitions (types, encoders and decoders) from the other Elm module,
198+
`Domain/Definitions.elm`.

0 commit comments

Comments
 (0)