| 319 | } |
| 320 | |
| 321 | func TestSource_JSONSchemaExtend(t *testing.T) { |
| 322 | data, err := jsonschema.Generate(new(Source)) |
| 323 | require.NoError(t, err) |
| 324 | jsonschema.TestJSONSchema(t, string(data), []jsonschema.TestCase{ |
| 325 | { |
| 326 | Name: "empty", |
| 327 | Err: true, |
| 328 | Spec: `{}`, |
| 329 | }, |
| 330 | { |
| 331 | Name: "null", |
| 332 | Err: true, |
| 333 | Spec: `null`, |
| 334 | }, |
| 335 | { |
| 336 | Name: "bad type", |
| 337 | Err: true, |
| 338 | Spec: `[]`, |
| 339 | }, |
| 340 | { |
| 341 | Name: "missing spec", |
| 342 | Spec: `{"name":"a","path":"b","registry":"local","tables":["*"],"destinations":["a"]}`, |
| 343 | }, |
| 344 | { |
| 345 | Name: "empty spec", |
| 346 | Spec: `{"name":"a","path":"b","registry":"local","tables":["*"],"destinations":["a"],"spec":{}}`, |
| 347 | }, |
| 348 | { |
| 349 | Name: "null spec", |
| 350 | Spec: `{"name":"a","path":"b","registry":"local","tables":["*"],"destinations":["a"],"spec":null}`, |
| 351 | }, |
| 352 | { |
| 353 | Name: "bad spec type", |
| 354 | Err: true, |
| 355 | Spec: `{"name":"a","path":"b","registry":"local","tables":["*"],"destinations":["a"],"spec":[]}`, |
| 356 | }, |
| 357 | { |
| 358 | Name: "missing tables", |
| 359 | Err: true, |
| 360 | Spec: `{"name":"a","path":"b","registry":"local","destinations":["a"]}`, |
| 361 | }, |
| 362 | { |
| 363 | Name: "empty tables", |
| 364 | Err: true, |
| 365 | Spec: `{"name":"a","path":"b","registry":"local","destinations":["a"], |
| 366 | "tables":[] |
| 367 | }`, |
| 368 | }, |
| 369 | { |
| 370 | Name: "null tables", |
| 371 | Err: true, |
| 372 | Spec: `{"name":"a","path":"b","registry":"local","destinations":["a"], |
| 373 | "tables":null |
| 374 | }`, |
| 375 | }, |
| 376 | { |
| 377 | Name: "bad tables type", |
| 378 | Err: true, |