MCPcopy Create free account
hub / github.com/dataform-co/dataform / verifyConfig

Method verifyConfig

core/actions/operation.ts:396–431  ·  view source on GitHub ↗

* @hidden Verify config checks that the constructor provided config matches the expected proto * structure, or the previously accepted legacy structure. If the legacy structure is used, it is * converted to the new structure.

(
    unverifiedConfig: ILegacyOperationConfig
  )

Source from the content-addressed store, hash-verified

394 * converted to the new structure.
395 */
396 private verifyConfig(
397 unverifiedConfig: ILegacyOperationConfig
398 ): dataform.ActionConfig.OperationConfig {
399 // The "type" field only exists on legacy view configs. Here we convert them to the new format.
400 if (unverifiedConfig.type) {
401 delete unverifiedConfig.type;
402 if (unverifiedConfig.dependencies) {
403 unverifiedConfig.dependencyTargets = unverifiedConfig.dependencies.map(
404 (dependency: string | object) => resolvableAsActionConfigTarget(dependency)
405 );
406 delete unverifiedConfig.dependencies;
407 }
408 if (unverifiedConfig.database) {
409 unverifiedConfig.project = unverifiedConfig.database;
410 delete unverifiedConfig.database;
411 }
412 if (unverifiedConfig.schema) {
413 unverifiedConfig.dataset = unverifiedConfig.schema;
414 delete unverifiedConfig.schema;
415 }
416 if (unverifiedConfig.fileName) {
417 unverifiedConfig.filename = unverifiedConfig.fileName;
418 delete unverifiedConfig.fileName;
419 }
420 if (unverifiedConfig.columns) {
421 unverifiedConfig.columns = ColumnDescriptors.mapLegacyObjectToConfigProto(
422 unverifiedConfig.columns as any
423 );
424 }
425 }
426 return verifyObjectMatchesProto(
427 dataform.ActionConfig.OperationConfig,
428 unverifiedConfig,
429 VerifyProtoErrorBehaviour.SHOW_DOCS_LINK
430 );
431 }
432}
433
434/**

Callers 1

constructorMethod · 0.95

Tested by

no test coverage detected