@@ -56,8 +56,8 @@ func TestFromFile(t *testing.T) {
56
56
out : & FileInfo {
57
57
File : & build.File {
58
58
Filename : "" ,
59
- Encoding : "cue" ,
60
- Form : "schema" ,
59
+ Encoding : build . CUE ,
60
+ Form : build . Schema ,
61
61
},
62
62
Definitions : true ,
63
63
Data : true ,
@@ -83,8 +83,8 @@ func TestFromFile(t *testing.T) {
83
83
out : & FileInfo {
84
84
File : & build.File {
85
85
Filename : "" ,
86
- Encoding : "cue" ,
87
- Form : "data" ,
86
+ Encoding : build . CUE ,
87
+ Form : build . Data ,
88
88
},
89
89
Data : true ,
90
90
Docs : true ,
@@ -107,8 +107,8 @@ func TestFromFile(t *testing.T) {
107
107
out : & FileInfo {
108
108
File : & build.File {
109
109
Filename : "foo.yaml" ,
110
- Encoding : "yaml" ,
111
- Form : "graph" ,
110
+ Encoding : build . YAML ,
111
+ Form : build . Graph ,
112
112
},
113
113
Data : true ,
114
114
References : true ,
@@ -121,14 +121,14 @@ func TestFromFile(t *testing.T) {
121
121
name : "yaml+openapi" ,
122
122
in : build.File {
123
123
Filename : "foo.yaml" ,
124
- Interpretation : "openapi" ,
124
+ Interpretation : build . OpenAPI ,
125
125
},
126
126
out : & FileInfo {
127
127
File : & build.File {
128
128
Filename : "foo.yaml" ,
129
- Encoding : "yaml" ,
130
- Interpretation : "openapi" ,
131
- Form : "schema" ,
129
+ Encoding : build . YAML ,
130
+ Interpretation : build . OpenAPI ,
131
+ Form : build . Schema ,
132
132
},
133
133
Definitions : true ,
134
134
Data : true ,
@@ -151,9 +151,9 @@ func TestFromFile(t *testing.T) {
151
151
out : & FileInfo {
152
152
File : & build.File {
153
153
Filename : "data.json" ,
154
- Encoding : "json" ,
155
- Interpretation : "auto" ,
156
- Form : "schema" ,
154
+ Encoding : build . JSON ,
155
+ Interpretation : build . Auto ,
156
+ Form : build . Schema ,
157
157
},
158
158
Definitions : true ,
159
159
Data : true ,
@@ -176,9 +176,9 @@ func TestFromFile(t *testing.T) {
176
176
out : & FileInfo {
177
177
File : & build.File {
178
178
Filename : "foo.json" ,
179
- Encoding : "json" ,
179
+ Encoding : build . JSON ,
180
180
Interpretation : "jsonschema" ,
181
- Form : "schema" ,
181
+ Form : build . Schema ,
182
182
},
183
183
Definitions : true ,
184
184
Data : true ,
@@ -196,15 +196,15 @@ func TestFromFile(t *testing.T) {
196
196
name : "JSONOpenAPI" ,
197
197
in : build.File {
198
198
Filename : "foo.json" ,
199
- Interpretation : "openapi" ,
199
+ Interpretation : build . OpenAPI ,
200
200
},
201
201
mode : Def ,
202
202
out : & FileInfo {
203
203
File : & build.File {
204
204
Filename : "foo.json" ,
205
- Encoding : "json" ,
206
- Interpretation : "openapi" ,
207
- Form : "schema" ,
205
+ Encoding : build . JSON ,
206
+ Interpretation : build . OpenAPI ,
207
+ Form : build . Schema ,
208
208
},
209
209
Definitions : true ,
210
210
Data : true ,
@@ -222,15 +222,15 @@ func TestFromFile(t *testing.T) {
222
222
name : "OpenAPIDefaults" ,
223
223
in : build.File {
224
224
Filename : "-" ,
225
- Interpretation : "openapi" ,
225
+ Interpretation : build . OpenAPI ,
226
226
},
227
227
mode : Def ,
228
228
out : & FileInfo {
229
229
File : & build.File {
230
230
Filename : "-" ,
231
- Encoding : "json" ,
232
- Interpretation : "openapi" ,
233
- Form : "schema" ,
231
+ Encoding : build . JSON ,
232
+ Interpretation : build . OpenAPI ,
233
+ Form : build . Schema ,
234
234
},
235
235
Definitions : true ,
236
236
Data : true ,
@@ -253,8 +253,8 @@ func TestFromFile(t *testing.T) {
253
253
out : & FileInfo {
254
254
File : & build.File {
255
255
Filename : "foo.go" ,
256
- Encoding : "code" ,
257
- Form : "schema" ,
256
+ Encoding : build . Code ,
257
+ Form : build . Schema ,
258
258
Tags : map [string ]string {"lang" : "go" },
259
259
},
260
260
Definitions : true ,
@@ -266,7 +266,6 @@ func TestFromFile(t *testing.T) {
266
266
KeepDefaults : true ,
267
267
Incomplete : true ,
268
268
Imports : true ,
269
- Stream : false ,
270
269
Docs : true ,
271
270
Attributes : true ,
272
271
},
@@ -290,8 +289,8 @@ func TestParseFile(t *testing.T) {
290
289
mode : Input ,
291
290
out : & build.File {
292
291
Filename : "file.json" ,
293
- Encoding : "json" ,
294
- Interpretation : "auto" ,
292
+ Encoding : build . JSON ,
293
+ Interpretation : build . Auto ,
295
294
},
296
295
}, {
297
296
in : ".json" ,
@@ -302,49 +301,50 @@ func TestParseFile(t *testing.T) {
302
301
mode : Input ,
303
302
out : & build.File {
304
303
Filename : ".json.yaml" ,
305
- Encoding : "yaml" ,
306
- Interpretation : "auto" ,
304
+ Encoding : build . YAML ,
305
+ Interpretation : build . Auto ,
307
306
},
308
307
}, {
309
308
in : "file.json" ,
310
309
mode : Def ,
311
310
out : & build.File {
312
311
Filename : "file.json" ,
313
- Encoding : "json" ,
312
+ Encoding : build . JSON ,
314
313
},
315
314
}, {
316
315
in : "schema:file.json" ,
317
316
out : & build.File {
318
317
Filename : "file.json" ,
319
- Encoding : "json" ,
320
- Interpretation : "auto" ,
321
- Form : "schema" ,
318
+ Encoding : build . JSON ,
319
+ Interpretation : build . Auto ,
320
+ Form : build . Schema ,
322
321
},
323
322
}, {
324
323
in : "openapi:-" ,
325
324
out : & build.File {
326
325
Filename : "-" ,
327
- Encoding : "json" ,
328
- Interpretation : "openapi" ,
326
+ Encoding : build .JSON ,
327
+ Form : build .Schema ,
328
+ Interpretation : build .OpenAPI ,
329
329
},
330
330
}, {
331
331
in : "cue:file.json" ,
332
332
out : & build.File {
333
333
Filename : "file.json" ,
334
- Encoding : "cue" ,
334
+ Encoding : build . CUE ,
335
335
},
336
336
}, {
337
337
in : "cue+schema:-" ,
338
338
out : & build.File {
339
339
Filename : "-" ,
340
- Encoding : "cue" ,
341
- Form : "schema" ,
340
+ Encoding : build . CUE ,
341
+ Form : build . Schema ,
342
342
},
343
343
}, {
344
344
in : "code+lang=js:foo.x" ,
345
345
out : & build.File {
346
346
Filename : "foo.x" ,
347
- Encoding : "code" ,
347
+ Encoding : build . Code ,
348
348
Tags : map [string ]string {"lang" : "js" },
349
349
},
350
350
}, {
@@ -358,14 +358,14 @@ func TestParseFile(t *testing.T) {
358
358
mode : Input ,
359
359
out : & build.File {
360
360
Filename : "-" ,
361
- Encoding : "cue" ,
361
+ Encoding : build . CUE ,
362
362
},
363
363
}, {
364
364
in : "-" ,
365
365
mode : Export ,
366
366
out : & build.File {
367
367
Filename : "-" ,
368
- Encoding : "json" ,
368
+ Encoding : build . JSON ,
369
369
},
370
370
}}
371
371
for _ , tc := range testCases {
@@ -385,36 +385,37 @@ func TestParseArgs(t *testing.T) {
385
385
out : []* build.File {
386
386
{
387
387
Filename : "foo.json" ,
388
- Encoding : "json" ,
389
- Interpretation : "auto" ,
388
+ Encoding : build . JSON ,
389
+ Interpretation : build . Auto ,
390
390
},
391
391
{
392
392
Filename : "baz.yaml" ,
393
- Encoding : "yaml" ,
394
- Interpretation : "auto" ,
393
+ Encoding : build . YAML ,
394
+ Interpretation : build . Auto ,
395
395
},
396
396
},
397
397
}, {
398
398
in : "data: foo.cue" ,
399
399
out : []* build.File {
400
- {Filename : "foo.cue" , Encoding : "cue" , Form : "data" },
400
+ {Filename : "foo.cue" , Encoding : build . CUE , Form : build . Data },
401
401
},
402
402
}, {
403
403
in : "json: foo.json bar.data jsonschema: bar.schema" ,
404
404
out : []* build.File {
405
- {Filename : "foo.json" , Encoding : "json" }, // no auto!
406
- {Filename : "bar.data" , Encoding : "json" },
405
+ {Filename : "foo.json" , Encoding : build . JSON }, // no auto!
406
+ {Filename : "bar.data" , Encoding : build . JSON },
407
407
{
408
408
Filename : "bar.schema" ,
409
- Encoding : "json" ,
409
+ Encoding : build .JSON ,
410
+ Form : build .Schema ,
410
411
Interpretation : "jsonschema" ,
411
412
},
412
413
},
413
414
}, {
414
415
in : `json: c:\foo.json c:\path\to\file.dat` ,
415
416
out : []* build.File {
416
- {Filename : `c:\foo.json` , Encoding : "json" },
417
- {Filename : `c:\path\to\file.dat` , Encoding : "json" },
417
+ {Filename : `c:\foo.json` , Encoding : build . JSON },
418
+ {Filename : `c:\path\to\file.dat` , Encoding : build . JSON },
418
419
},
419
420
}, {
420
421
in : "json: json+schema: bar.schema" ,
0 commit comments