MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / TestBackendOptions_JSONSchema

Function TestBackendOptions_JSONSchema

cli/internal/specs/v0/source_test.go:265–319  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

263}
264
265func TestBackendOptions_JSONSchema(t *testing.T) {
266 data, err := jsonschema.Generate(new(BackendOptions))
267 require.NoError(t, err)
268 jsonschema.TestJSONSchema(t, string(data), []jsonschema.TestCase{
269 {
270 Name: "empty",
271 Err: true,
272 Spec: `{}`,
273 },
274 {
275 Name: "missing table_name",
276 Err: true,
277 Spec: `{"connection":"a"}`,
278 },
279 {
280 Name: "empty table_name",
281 Err: true,
282 Spec: `{"table_name":"","connection":"a"}`,
283 },
284 {
285 Name: "null table_name",
286 Err: true,
287 Spec: `{"table_name":null,"connection":"a"}`,
288 },
289 {
290 Name: "bad table_name type",
291 Err: true,
292 Spec: `{"table_name":123,"connection":"a"}`,
293 },
294 {
295 Name: "missing connection",
296 Err: true,
297 Spec: `{"table_name":"a"}`,
298 },
299 {
300 Name: "empty connection",
301 Err: true,
302 Spec: `{"table_name":"a","connection":""}`,
303 },
304 {
305 Name: "null connection",
306 Err: true,
307 Spec: `{"table_name":"a","connection":null}`,
308 },
309 {
310 Name: "bad connection type",
311 Err: true,
312 Spec: `{"table_name":"a","connection":123}`,
313 },
314 {
315 Name: "proper",
316 Spec: `{"table_name":"a","connection":"b"}`,
317 },
318 })
319}
320
321func TestSource_JSONSchemaExtend(t *testing.T) {
322 data, err := jsonschema.Generate(new(Source))

Callers

nothing calls this directly

Calls 1

GenerateMethod · 0.80

Tested by

no test coverage detected