{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Source Loader Configuration",
  "description": "Defines the required field for the source loader application that uses the DW Source Loader library. The application configuration can have other root-level fields.",
  "type": "object",
  "$defs": {
    "commentFields": {
      "patternProperties": {
        "^__": {
          "type": ["string", "number", "integer", "boolean", "object", "array", "null"],
          "description": "Comment field begins with two underscores. There can be any number of comment fields."
        }
      }
    },
    "jdbcOptions": {
      "title":  "JDBC Options",
      "description": "These options are applicable to all JDBC databases - currently SQL Server and Oracle. See https://spark.apache.org/docs/latest/sql-data-sources-jdbc.html for details.",
      "type": "object",
      "properties": {
        "url": {
          "type": "string"
        },
        "dbtable": {
          "description": "When the load action defines an incremental load, this attribute, if used, should have a statement that loads data incrementally based on a watermark column or columns. A watermark column is a column whose previously loaded MAX value is used to determine the new rows for the incremental load.",
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        },
        "query": {
          "description": "When the load action defines an incremental load, this attribute, if used, should have a statement that loads data incrementally based on a watermark column or columns. A watermark column is a column whose previously loaded MAX value is used to determine the new rows for the incremental load.",
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        },
        "prepareQuery": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        },
        "lowerBound": {
          "type": "string"
        },
        "upperBound": {
          "type": "string"
        },
        "numPartitions": {
          "type": "number"
        },
        "queryTimeout": {
          "type": "number"
        },
        "fetchsize": {
          "type": "number"
        },
        "sessionInitStatement": {
          "type": "string"
        },
        "pushDownPredicate": {
          "type": "boolean"
        },
        "pushDownAggregate": {
          "type": "boolean"
        },
        "pushDownLimit": {
          "type": "boolean"
        },
        "pushDownOffset": {
          "type": "boolean"
        },
        "pushDownTableSample": {
          "type": "boolean"
        },
        "keytab": {
          "type": "string"
        },
        "principal": {
          "type": "string"
        },
        "refreshKrb5Config": {
          "type": "boolean"
        },
        "preferTimestampNTZ": {
          "type": "boolean"
        },
        "hint": {
          "type": "string"
        }
      },
      "not": {
        "required": ["partitionColumn"],
        "description": "\"partitionColumn\" is excluded from the list of options for the JDBC source, since this column has to be defined in \"schema\" with the \"isPartitionColumn\" flag."
      },
      "allOf": [ { "$ref": "#/$defs/commentFields" } ],
      "required": [
        "url"
      ],
      "customMessage": {
        "not": "The field \"partitionColumn\" is not allowed within the dbms object, as it must be defined in the \"schema\" with the \"isPartitionColumn\" flag set to true (the tool needs the column type for internal logic)."
      },
      "unevaluatedProperties": false
    }
  },
  "properties": {
    "sourceLoad": {
      "type": "object",
      "description": "Configuration for Source Loader",
      "properties": {
        "loadActions": {
          "type": "array",
          "description": "Specifications for loading files or database tables into staging files. A load action is used to load one database table or one file. A single load action can also be used to load multiple files if their names follow the same pattern, with a date as the variable part.",
          "items": {
            "type": "object",
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "fileSource"
                ],
                "properties": {
                  "fileSource": {
                    "type": "object",
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "fileSystemLocation": {
                            "type": "object",
                            "properties": {
                              "dir": {
                                "type": "string"
                              },
                              "namePattern": {
                                "type": "string",
                                "description": "A regular expression for the file names to process. The files can have an effective date as part of the name. In that case, the files are processed in ascending date order."
                              }
                            },
                            "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                            "required": [
                              "dir",
                              "namePattern"
                            ],
                            "unevaluatedProperties": false
                          }
                        },
                        "required": [
                          "fileSystemLocation"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "internetLocation": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string"
                              },
                              "user": {
                                "type": "string"
                              },
                              "password": {
                                "type": "string"
                              },
                              "isDisableSslVerification": {
                                "type": "boolean"
                              }
                            },
                            "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                            "required": [
                              "url"
                            ],
                            "unevaluatedProperties": false
                          }
                        },
                        "required": [
                          "internetLocation"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "customLocation": {
                            "type": "object",
                            "description": "This attribute must be defined when a user function is used to provide the path of the file to be loaded. The user function must be implemented as a Scala object or Java static method. The method must take one parameter of type Option[Config] and return a String with the file path or file content (depending on the \"methodReturns\" value, \"FilePath\" or \"FileData\"), e.g.,\n\ndef sampleForCsvFileCustomLocation( params: Option[Config] ): String = {\n  s\"/some-path/csv-file.csv\"\n}\n",
                            "properties": {
                              "packageName": {
                                "type": "string"
                              },
                              "moduleName": {
                                "type": "string"
                              },
                              "methodName": {
                                "type": "string"
                              },
                              "methodReturns": {
                                "type": "string",
                                "description": "The type of data that the method returns: FilePath - the path of the file, FileData - a string with the file content.",
                                "enum": [
                                  "FilePath",
                                  "FileData"
                                ]
                              },
                              "applicationSpecific": {
                                "type": "object",
                                "unevaluatedProperties": true
                              }
                            },
                            "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                            "required": [
                              "moduleName",
                              "methodName",
                              "methodReturns"
                            ],
                            "unevaluatedProperties": false
                          }
                        },
                        "required": [
                          "customLocation"
                        ]
                      }
                    ],
                    "properties": {
                      "isRemoveDuplicateRows": {
                        "type": "boolean"
                      },
                      "effectiveDate": {
                        "type": "string",
                        "format": "date"
                      },
                      "csv": {
                        "type": "object",
                        "description": "Specifies that the file being loaded is a .csv file. This object can optionally specify any valid Spark read options for loading a csv file.\n\nExample of a configuration with no options:\n\"csv\" : { }\n\nExample of a configuration with some options:\n\"csv\" :\n{\n  \"mode\" : \"PERMISSIVE\",\n  \"header\" : true,\n  \"encoding\" : \"ISO-8859-1\"\n}\nProperties for a csv file can be any of the options for Spark csv file processing. The \"schema\" array must be defined if inferSchema is not set to true.",
                        "properties": {
                          "mode": {
                            "type": "string"
                          },
                          "header": {
                            "type": "boolean"
                          },
                          "encoding": {
                            "type": "string"
                          },
                          "dateFormat": {
                            "type": "string"
                          },
                          "nullValue": {
                            "type": "string"
                          },
                          "escape": {
                            "type": "string"
                          },
                          "quote": {
                            "type": "string"
                          },
                          "delimiter": {
                            "type": "string"
                          },
                          "multiLine": {
                            "type": "boolean"
                          },
                          "inferSchema": {
                            "type": "boolean"
                          },
                          "prefersDate": {
                            "type": "boolean"
                          },
                          "trueValue": {
                            "type": "string"
                          },
                          "falseValue": {
                            "type": "string"
                          }
                        },
                        "unevaluatedProperties": false
                      },
                      "processedFilesDir": {
                        "type": "string"
                      }
                    },
                    "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                    "required": [
                      "csv",
                      "processedFilesDir"
                    ],
                    "unevaluatedProperties": false
                  }
                },
                "allOf": [ { "$ref": "#/$defs/commentFields" } ]
              },
              {
                "type": "object",
                "required": [
                  "dbmsSource"
                ],
                "properties": {
                  "dbmsSource": {
                    "type": "object",
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "sqlServer": {
                            "$ref": "#/$defs/jdbcOptions",
                            "description": "Defines SQL Server as the source DBMS. The fields in the sqlServer object can be any valid fields defined by the Spark specification for a JDBC database source – see https://spark.apache.org/docs/latest/sql-data-sources-jdbc.html.\nFor example,\n\"url\" : \"jdbc:sqlserver://my-server\\\\SQLSERVER2019:1433;database=my-db-name;integratedSecurity=true;\".\n\nIf \"numPartitions\" is defined then one of the columns in \"schema\" must have the \"isPartitionColumn\" attribute set to true. The \"lowerBound\" and \"upperBound\" are optional; if absent, they will be determined by the loader by querying the source table.\n"
                          }
                        },
                        "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                        "required": [
                          "sqlServer"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "oracle": {
                            "$ref": "#/$defs/jdbcOptions",
                            "description": "Defines Oracle as the source DBMS. The fields inside the oracle object can be any valid fields defined by the Spark specification for a JDBC database source – see https://spark.apache.org/docs/latest/sql-data-sources-jdbc.html\nFor example,\n\"url\" : \"jdbc:oracle:thin@//host-name:port/service-name\"\n."
                          }
                        },
                        "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                        "required": [
                          "oracle"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "mongoDb": {
                            "type": "object",
                            "description": "Properties for dbmsSource mongoDb can be any of the options supported by the MongoDB Spark connector in batch mode. The schema must be defined.",
                            "properties": {
                              "connection.uri": {
                                "type": "string"
                              },
                              "database": {
                                "type": "string"
                              },
                              "collection": {
                                "type": "string"
                              },
                              "comment": {
                                "type": "string"
                              },
                              "mode": {
                                "type": "string"
                              },
                              "columnNameOfCorruptRecord": {
                                "type": "string"
                              },
                              "mongoClientFactory": {
                                "type": "string"
                              },
                              "partitioner": {
                                "type": "string"
                              },
                              "sampleSize": {
                                "type": "number"
                              },
                              "sql.inferSchema.mapTypes.enabled": {
                                "type": "boolean"
                              },
                              "sql.inferSchema.mapTypes.minimum.key.size": {
                                "type": "number"
                              },
                              "aggregation.pipeline": {
                                "description": "When the load action defines an incremental load, this attribute, if used, should have a statement that loads data incrementally based on a watermark column or columns. A watermark column is a column whose previously loaded MAX value is used to determine the new rows for the incremental load.",
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                ]
                              },
                              "aggregation.allowDiskUse": {
                                "type": "boolean"
                              },
                              "outputExtendedJson": {
                                "type": "boolean"
                              }
                            },
                            "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                            "patternProperties": {
                              "^partitioner\\.options\\.": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "connection.uri", "collection"
                            ],
                            "unevaluatedProperties": false
                          }
                        },
                        "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                        "required": [
                          "mongoDb"
                        ]
                      }
                    ],
                    "properties": {
                      "isRemoveDuplicateRows": {
                        "type": "boolean"
                      },
                      "effectiveDate": {
                        "type": "string",
                        "format": "date"
                      },
                      "user": {
                        "type": "string"
                      },
                      "password": {
                        "type": "string"
                      },
                      "incrementalLoad": {
                        "type": "object",
                        "description": "Incremental load defines loading of newly added or changed data from the source. The incremental load uses a field designated as the watermark column. The watermark column can be any value that grows when a row is inserted or updated, e.g., a row update timestamp or, in the case of SQL Server, a ROWVERSION column. The loader determines the MAX value for the watermark column in the current data and injects it into the query to allow selection of data rows that were added or changed since the last load.",
                        "properties": {
                          "uniqueKeys": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            ],
                            "description": "Unique keys are needed to delete records from the destination file for keys that are no longer in the source. If unique keys are not defined, they will be generated programmatically."
                          },
                          "delimForWatermarkColumns": {
                            "description": "Watermark columns are the columns in the destination file that are used in an incremental load. The query to get data incrementally uses the current MAX value of the watermark column to get new records whose watermark column value is greater than the one already in the destination file. The delimiter designates a column in the query as a watermark column. For example, with three colons as the delimiter, the query for incremental load may look like this: SELECT OrderNumber, OrderTime From Orders WHERE OrderTime > :::OrderTime:::",
                            "type": "string",
                            "pattern": "^[:@#!-]+$",
                            "maxLength": 5
                          }
                        },
                        "required": [
                          "delimForWatermarkColumns"
                        ],
                        "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                        "unevaluatedProperties": false
                      }
                    },
                    "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                    "required": [
                    ],
                    "dependentSchemas": {
                      "sqlServer": {
                        "properties": {
                          "incrementalLoad": {
                            "required": ["uniqueKeys"]
                          }
                        },
                        "customMessage": {
                          "required": {
                            "uniqueKeys": "\"uniqueKeys\" attribute is missing. It is required for incremental load with sqlServer."
                          }
                        }
                      },
                      "oracle": {
                        "properties": {
                          "incrementalLoad": {
                            "required": ["uniqueKeys"]
                          }
                        },
                        "customMessage": {
                          "required": {
                            "uniqueKeys": "\"uniqueKeys\" attribute is missing. It is required for incremental load with oracle."
                          }
                        }
                      }
                    },
                    "unevaluatedProperties": false
                  }
                },
                "allOf": [ { "$ref": "#/$defs/commentFields" } ]
              }
            ],
            "properties": {
              "name": {
                "type": "string",
                "description": "The name of the load action, used to differentiate multiple load actions. It must be unique within the configuration."
              },
              "isActive": {
                "type": "boolean",
                "description": "If the value of isActive is false, the load action will not be processed."
              },
              "isDebugDwLib": {
                "type": "boolean",
                "description": "If the value is true, the library will send some dataframe-related output to standard output, which slows down job execution."
              },
              "fileLoadControl": {
                "type": "object",
                "description": "When this attribute is defined, the loader will create a file with summary information for each load. The information includes record counts, descriptions of the source and destination, and action timing.",
                "properties": {
                  "parquet": {
                    "type": "object",
                    "description": "The file type for load control is Parquet."
                  },
                  "dir": {
                    "type": "string",
                    "description": "A directory with the load control file."
                  }
                },
                "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                "required": [
                  "parquet",
                  "dir"
                ],
                "unevaluatedProperties": false
              },
              "fileDestination": {
                "type": "object",
                "properties": {
                  "isVersioned": {
                    "description": "When the value of isVersioned is true, the loader will maintain a versioned destination file. A new version of the row is inserted, based on the unique key, when any of the field values change. The unique key can be a single column or multiple columns (compound key). The granularity of versioning is a calendar day defined by the effective date. If a source has a date field designated as the effective date, its value will be used to create versions. In the absence of such a field, the loader will use the current date.\n\n\nWhen isVersioned is set to false, the loader will maintain a non-versioned destination file. A non-versioned file saves the data for every effective date in full.",
                    "type": "boolean"
                  },
                  "metadataColumnsPrefix": {
                    "description": "Metadata columns are the columns with reserved names that serve special functions. If the name of a metadata column collides with a data column name, use the metadata columns prefix to differentiate the names.",
                    "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
                    "type": "string"
                  },
                  "parquet": {
                    "description": "Defines Parquet as the type of the destination file.",
                    "type": "object"
                  },
                  "path": {
                    "description": "Full path of the destination file.",
                    "type": "string"
                  },
                  "previousCopyPath": {
                    "description": "If defined, the Source Loader will save a copy of the current file under this name. This can be useful for going back to the previous version of the file if needed.",
                    "type": "string"
                  }
                },
                "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                "required": [
                  "parquet",
                  "path",
                  "isVersioned"
                ],
                "unevaluatedProperties": false
              },
              "schema": {
                "type": "array",
                "description": "The schema defines the structure of the destination file. The schema can be absent for a DBMS source. It can also be absent for a file source if the \"inferSchema\" option is set to true.\n\nIf fileDestination.isVersioned is set to true, the schema must have one or more columns with the isUniqueKey attribute set to true.\n",
                "items": {
                  "type": "object",
                  "properties": {
                    "colName": {
                      "description": "Column name",
                      "type": "string"
                    },
                    "colType": {
                      "description": "Column data type",
                      "type": "string"
                    },
                    "isUniqueKey": {
                      "description": "Designates a column as a unique key. This column attribute cannot be derived from the DBMS, so to designate a column as a unique key, the column has to be included in the schema.\n\nMultiple columns can be designated as unique keys to create a composite unique key.\n\nThe unique key is used for incremental load from DBMS sources or for creating a versioned destination file.\n",
                      "type": "boolean"
                    },
                    "isPartitionColumn": {
                      "description": "For a DBMS source, one column can be defined as the partition column to read data on multiple connections in parallel. isPartitionColumn must be defined if numPartitions is defined.",
                      "type": "boolean"
                    },
                    "isExcludeFromVersioning": {
                      "description": "This field is used for a versioned destination file. When this flag is set to true, a change to the field in the source will not trigger the creation of a new version of the row.",
                      "type": "boolean"
                    },
                    "formats": {
                      "description": "Allowed formats for a Timestamp or Date column when loaded from a csv file. Requires colType to be Timestamp or Date.",
                      "type": "array",
                      "minItems": 1,
                      "items": {
                        "type": "string"
                      },
                      "customMessage": {
                        "minItems": "\"formats\" array must have at least one format defined."
                      }
                    }
                  },
                  "required": [
                    "colName"
                  ],
                  "allOf": [
                    { "$ref": "#/$defs/commentFields" },
                    {
                      "if": {
                        "properties": {
                          "isPartitionColumn": {
                            "const": true
                          }
                        },
                        "required": ["isPartitionColumn"]
                      },
                      "then": {
                        "description": "If \"isPartitionColumn\" attribute of a column is set to true, colType must be defined (it is needed to determine the type of upper and lower bounds).",
                        "required": ["colType"],
                        "customMessage": {
                          "required": "\"colType\" is required when \"isPartitionColumn\" is true."
                        }
                      }
                    },
                    {
                      "if": {
                        "required": ["formats"]
                      },
                      "then": {
                        "description": "\"formats\" is only allowed for columns of type Timestamp or Date, so \"colType\" must be defined and be one of them.",
                        "required": ["colType"],
                        "properties": {
                          "colType": {
                            "pattern": "^([Tt][Ii][Mm][Ee][Ss][Tt][Aa][Mm][Pp]|[Dd][Aa][Tt][Ee])$",
                            "customMessage": {
                              "pattern": "\"formats\" is only allowed when \"colType\" is Timestamp or Date."
                            }
                          }
                        },
                        "customMessage": {
                          "required": "\"colType\" is required when \"formats\" is defined, and it must be Timestamp or Date."
                        }
                      }
                    }
                  ],
                  "unevaluatedProperties": false
                }
              },
              "schemaEvolution" : {
                "type": "object",
                "description": "Definition of the allowed changes to the data schema on consecutive loads, for both versioned and non-versioned data.",
                "properties": {
                  "allowMetadataColumnsPrefixChange" : {
                    "description": "If true, the \"metadataColumnsPrefix\" value can change on consecutive loads.",
                    "type": "boolean"
                  },
                  "columnAdd": {
                    "type": "object",
                    "properties": {
                      "isAllow": {
                        "description": "When the value of isAllow is true, the data on consecutive loads can have new columns.",
                        "type": "boolean"
                      },
                      "columnsToAdd": {
                        "description": "The columns allowed to be added, with an optional value to populate previously loaded data. If this element is absent or empty and adding columns is allowed, any column can be added.",
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "colNamePattern": {
                              "type": "string",
                              "description": "A pattern for the names of columns allowed to be added."
                            },
                            "backfillValue": {
                              "type": ["string", "number", "integer", "boolean"],
                              "description": "The value for previously loaded data. The type should match the type of the column. If the value is omitted, it defaults to a value based on the column type, and if that is not defined, to null."
                            },
                            "unevaluatedProperties": false
                          },
                          "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                          "required": [
                            "colNamePattern"
                          ],
                          "unevaluatedProperties": false
                        }
                      },
                      "backfillValueForStrings": {
                        "description": "The value used to populate previously loaded data for new columns of string type. If a backfill value is defined for a specific column, it will take precedence over this value.",
                        "type": "string"
                      },
                      "backfillValueForFloats": {
                        "description": "The value used to populate previously loaded data for new columns of float or double type. If a backfill value is defined for a specific column, it will take precedence over this value.",
                        "type": "number"
                      },
                      "backfillValueForIntegers": {
                        "description": "The value used to populate previously loaded data for new columns of integer type. If a backfill value is defined for a specific column, it will take precedence over this value.",
                        "type": "integer"
                      },
                      "backfillValueForBooleans": {
                        "description": "The value used to populate previously loaded data for new columns of boolean type. If a backfill value is defined for a specific column, it will take precedence over this value.",
                        "type": "boolean"
                      }
                    },
                    "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                    "required": [
                      "isAllow"
                    ],
                    "unevaluatedProperties": false
                  },
                  "columnDelete": {
                    "type": "object",
                    "properties": {
                      "isAllow": {
                        "description": "When the value of isAllow is true, the data on consecutive loads can have omitted columns that will be deleted from previously loaded data.",
                        "type": "boolean"
                      },
                      "columnsToDelete": {
                        "description": "The name pattern for columns to be deleted. If this element is absent or empty and column deletion is allowed, any column can be deleted.",
                        "type": "array",
                        "items": { "type": "string" }
                      }
                    },
                    "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                    "required": [
                      "isAllow"
                    ],
                    "unevaluatedProperties": false
                  },
                  "columnTypeChange": {
                    "type": "object",
                    "properties": {
                      "isAllow": {
                        "description": "When the value of isAllow is true, the column data type can be changed to that of new data.",
                        "type": "boolean"
                      },
                      "columnsToChangeType": {
                        "description": "The name pattern for columns whose type is allowed to change. If this element is absent or empty and column type change is allowed, any column's type can be changed.",
                        "type": "array",
                        "items": { "type": "string" }
                      }
                    },
                    "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                    "required": [
                      "isAllow"
                    ],
                    "unevaluatedProperties": false
                  }
                },
                "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                "required": [
                ],
                "unevaluatedProperties": false
              },
              "postProcess": {
                "type": "object",
                "properties": {
                  "packageName": {
                    "type": "string"
                  },
                  "moduleName": {
                    "type": "string"
                  },
                  "methodName": {
                    "type": "string"
                  },
                  "stgSources": {
                    "type": "array",
                    "description": "Staging sources that are used for post-processing the current staging source. These sources will be preloaded and made available as views in the post-process method.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "The staging source id is a unique identifier of a staging source. It is used as the view name in Spark SQL."
                        },
                        "description": {
                          "type": "string"
                        },
                        "fileSource": {
                          "type": "object",
                          "properties": {
                            "parquet": {
                              "type": "object"
                            },
                            "path": {
                              "type": "string",
                              "description": "A Parquet file path."
                            }
                          },
                          "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                          "required": [
                            "parquet",
                            "path"
                          ],
                          "unevaluatedProperties": false
                        }
                      },
                      "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                      "required": [
                        "id",
                        "fileSource"
                      ],
                      "unevaluatedProperties": false
                    }
                  },
                  "applicationSpecific": {
                    "type": "object",
                    "unevaluatedProperties": true
                  }
                },
                "allOf": [ { "$ref": "#/$defs/commentFields" } ],
                "required": [
                  "moduleName",
                  "methodName"
                ],
                "unevaluatedProperties": false
              }
            },
            "required": [
              "name",
              "isActive",
              "fileDestination"
            ],
            "allOf": [
              { "$ref": "#/$defs/commentFields" },
              {
                "if": {
                  "properties": {
                    "fileDestination": {
                    "description": "If the destination file is defined with \"isVersioned\"=true, then the schema must be defined with at least one column as a primary key, i.e., \"isUniqueKey\": true.",
                      "properties": {
                        "isVersioned": { "const": true }
                      },
                      "required": ["isVersioned"]
                    }
                  },
                  "required": ["fileDestination"]
                },
                "then": {
                  "properties": {
                    "schema": {
                      "contains": {
                        "properties": {
                          "isUniqueKey": { "const": true }
                        },
                        "required": ["isUniqueKey"]
                      },
                      "customMessage": {
                        "contains": "The schema must have at least one column as a primary key when the destination has \"isVersioned\" set to true, i.e., \"isUniqueKey\": true."
                      }
                    }
                  },
                  "required": ["schema"],
                  "customMessage": {
                    "required": "\"schema\" must be defined with at least one column as a primary key when the destination has \"isVersioned\" set to true."
                  }
                }
              },
              {
                "if": {
                  "description": "If incrementalLoad is defined, then the destination must be versioned, i.e., with \"isVersioned\"=true.",
                  "properties": {
                    "dbmsSource": {
                      "required": [
                        "incrementalLoad"
                      ]
                    }
                  },
                  "required": [
                    "dbmsSource"
                  ]
                },
                "then": {
                  "properties": {
                    "fileDestination": {
                      "properties": {
                        "isVersioned": {
                          "const": true
                        }
                      },
                      "required": [
                        "isVersioned"
                      ],
                      "customMessage": {
                        "required": "\"isVersioned\" flag must be defined and set to true when \"incrementalLoad\" is defined for a DBMS source.",
                        "const": "\"isVersioned\" flag must be set to true when \"incrementalLoad\" is defined for a DBMS source."
                      }
                    }
                  },
                  "required": [
                    "fileDestination"
                  ]
                }
              },
              {
                "if": {
                  "description": "If any column in the schema defines \"formats\", the load action must be a csv file source.",
                  "properties": {
                    "schema": {
                      "contains": { "required": ["formats"] }
                    }
                  },
                  "required": ["schema"]
                },
                "then": {
                  "properties": {
                    "fileSource": {
                      "required": ["csv"]
                    }
                  },
                  "required": ["fileSource"],
                  "customMessage": {
                    "required": "\"formats\" is only allowed in the schema of a file source loaded from a csv file (\"fileSource\" with \"csv\"). It is not allowed for a parquet file or a DBMS source."
                  }
                }
              }
            ],
            "unevaluatedProperties": false
          }
        }
      },
      "allOf": [ { "$ref": "#/$defs/commentFields" } ],
      "required": [
        "loadActions"
      ],
      "unevaluatedProperties": false
    }
  },
  "required": [
    "sourceLoad"
  ],
  "unevaluatedProperties": true
}
