@@ -168,12 +168,31 @@ encodePoint point =
168
168
which contains an Elm type for the ` color ` and ` point ` definitions along with
169
169
their corresponding JSON decoders and encoders.
170
170
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.
173
173
174
174
``` 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
+ }
176
194
```
177
195
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