API Reference

This page details the TDK API endpoints available.

openapi: 3.0.1
info:
  title: "Testing suite common API"
  description: |
    Test
  version: "0.1"

x-package: io.synthesized.api

paths:
  /api/v1/ping:
    get:
      operationId: ping
      responses:
        "200":
          description: OK
  /api/v1/metadata:
    description: gets metadata for given connection
    post:
      operationId: getDbMeta
      tags:
        - meta
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatabaseConnection'
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Database'

  /api/v1/license-expiration:
    description: gets license expiration date
    get:
      operationId: getLicenseExpirationDate
      tags:
        - license
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LicenseExpiration'

  /api/v1/metadata/schemata:
    post:
      description: 'Returns schemas of input database'
      operationId: getDbMetaSchemas
      tags:
        - meta
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatabaseConnection'
      responses:
        "200":
          description: list of schema names
          content:
            application/json:
              schema:
                type: array
                nullable: false
                items:
                  type: string
                  nullable: false

  /api/v1/metadata/schemata/{schema_name}:
    parameters:
      - name: schema_name
        in: path
        required: true
        schema:
          type: string
          nullable: false
    post:
      operationId: getTables
      description: 'Returns tables of the given schema of input database'
      tags:
        - meta
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatabaseConnection'
      responses:
        "200":
          description: list of table names
          content:
            application/json:
              schema:
                type: array
                nullable: false
                items:
                  type: string
                  nullable: false

  /api/v1/configs/{schema_name}/{table_name}/effective:
    description: effective table configuration
    parameters:
      - name: schema_name
        in: path
        required: true
        schema:
          type: string
          nullable: false
      - name: table_name
        in: path
        required: true
        schema:
          type: string
          nullable: false
    post:
      operationId: tableConfig
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TableConfigRequest'
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TableConfig'

  /api/v1/validate-connection:
    description: validate connection
    post:
      operationId: validateConnection
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatabaseConnection'
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationResult'

  /api/v1/validate-workflow:
    description: validate workflow
    post:
      operationId: validateWorkflow
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                validateWorkflowRequest:
                  $ref: '#/components/schemas/ValidateWorkflowRequest'
                config:
                  type: string
                  format: binary
            encoding:
              runWorkflowRequest:
                contentType: application/json
              config:
                contentType: application/octet-stream
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationResult'

  /api/v1/workflow-run:
    description: run workflow
    post:
      operationId: runWorkflow
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                runWorkflowRequest:
                  $ref: '#/components/schemas/RunWorkflowRequest'
                config:
                  type: string
                  format: binary
                  nullable: true
            encoding:
              runWorkflowRequest:
                contentType: application/json
              config:
                contentType: application/octet-stream
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunWorkflowResponse'

  /api/v1/workflow/{id}/stop:
    description: stop workflow
    post:
      operationId: stopWorkflow
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
            nullable: false
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StopWorkflowResponse'

  /api/v1/workflow-run/{id}/stop:
    description: stop workflowRun
    post:
      operationId: stopWorkflowRun
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
            nullable: false
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StopWorkflowResponse'

  /api/v1/workflow-run/{id}:
    description: get workflow run
    get:
      operationId: getWorkflowRun
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
            nullable: false
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunWorkflowResponse'
  /api/v1/workflow/{workflow_id}/runs:
    description: get workflow runs
    get:
      operationId: listWorkflowRuns
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: integer
            format: int64
            nullable: false
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                nullable: false
                items:
                  $ref: '#/components/schemas/RunWorkflowResponse'
  /api/v1/workflow/last-workflow-runs-status:
    description: get last workflow runs status
    post:
      operationId: lastWorkflowRunsStatus
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowStatusRequest'
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                nullable: false
                items:
                  $ref: '#/components/schemas/WorkflowStatusResponse'

components:
  schemas:
    DataType:
      type: object
      title: DataTypeDTO
      nullable: false
      x-extends:
        - java.io.Serializable
      properties:
        type_name:
          type: string
          nullable: false
        sql_type_name:
          type: string
          default: 'null'
        length:
          type: integer
          default: 'null'
        precision:
          type: integer
          default: 'null'
        scale:
          type: integer
          default: 'null'
        nullable:
          type: boolean
          default: true
          nullable: false

    Field:
      type: object
      title: Field
      x-extends:
        - java.io.Serializable
      properties:
        name:
          type: string
          nullable: false
        database_id:
          type: string
          nullable: false
        schema:
          type: string
        table:
          type: string
          nullable: false
        data_type:
          $ref: "#/components/schemas/DataType"


    ForeignKey:
      type: object
      title: ForeignKey
      x-extends:
        - java.io.Serializable
      properties:
        database_id:
          type: string
          nullable: false
        schema:
          type: string
        table:
          type: string
          nullable: false
        name:
          type: string
          nullable: false
        fields:
          type: array
          items:
            type: string
          nullable: false
        referred_name:
          type: string
          nullable: false
        referred_database_id:
          type: string
          nullable: false
        referred_schema:
          type: string
        referred_table:
          type: string
        referred_fields:
          type: array
          items:
            type: string
          nullable: false

    PrimaryKey:
      type: object
      title: PrimaryKey
      x-extends:
        - java.io.Serializable
      properties:
        database_id:
          type: string
          nullable: false
        schema:
          type: string
        table:
          type: string
          nullable: false
        name:
          type: string
          nullable: false
        fields:
          type: array
          items:
            type: string
          nullable: false

    UniqueKey:
      type: object
      title: UniqueKey
      x-extends:
        - java.io.Serializable
      properties:
        database_id:
          type: string
          nullable: false
        schema:
          type: string
        table:
          type: string
          nullable: false
        name:
          type: string
          nullable: false
        fields:
          type: array
          items:
            type: string
          nullable: false

    Table:
      type: object
      title: Table
      nullable: false
      x-extends:
        - java.io.Serializable
      properties:
        name:
          type: string
          nullable: false
        fields:
          type: array
          items:
            $ref: '#/components/schemas/Field'
          nullable: false
        database_id:
          type: string
          nullable: false
        schema:
          type: string
        indexes:
          type: array
          items:
            type:
              string
          nullable: false
          default: []
        primary_key:
          $ref: "#/components/schemas/PrimaryKey"
        foreign_keys:
          type: array
          items:
            $ref: '#/components/schemas/ForeignKey'
          nullable: false
          default: []
        unique_keys:
          type: array
          items:
            $ref: '#/components/schemas/UniqueKey'
          nullable: false
          default: []

    SQLDialect:
      enum:
        - POSTGRES
        - MYSQL
        - MARIADB
        - SQLITE
        - ORACLE
        - MSSQL
        - H2

    Database:
      type: object
      title: Database
      properties:
        id:
          description: "Database Id"
          type: string
          nullable: false
        dialect:
          $ref: "#/components/schemas/SQLDialect"
        schemas:
          type: array
          nullable: false
          items:
            type: string
        tables:
          description: "Tables in the database"
          type: array
          nullable: false
          items:
            $ref: "#/components/schemas/Table"
          default: []
        triggers:
          type: array
          nullable: false
          items:
            type: string
          default: []
        views:
          type: array
          nullable: false
          items:
            type: string
          default: []
        procedures:
          type: array
          nullable: false
          items:
            type: string
          default: []
        users:
          type: array
          nullable: false
          items:
            type: string
          default: []

    ApiCallError:
      type: object
      properties:
        message:
          type: string
          nullable: false
        details:
          type: array
          nullable: false
          items:
            type: string
          default: []

    ValidationResult:
      type: object
      title: ValidationResultDTO
      nullable: false
      properties:
        failed:
          type: boolean
          nullable: false
        messages:
          type: array
          nullable: false
          items:
            type: string
          default: []

    RunWorkflowRequest:
      type: object
      title: RunWorkflowRequest
      nullable: false
      properties:
        input_connection:
          $ref: '#/components/schemas/DatabaseConnection'
        output_connection:
          $ref: '#/components/schemas/DatabaseConnection'
        workflow_id:
          nullable: false
          type: integer
          format: int64
        workflow_name:
          nullable: false
          type: string
        user_id:
          type: integer
          format: int64

    ValidateWorkflowRequest:
      type: object
      title: RunWorkflowRequest
      nullable: false
      properties:
        input_connection:
          $ref: '#/components/schemas/DatabaseConnection'
        output_connection:
          $ref: '#/components/schemas/DatabaseConnection'

    DatabaseConnection:
      type: object
      title: DatabaseConnection
      nullable: false
      properties:
        jdbc_url:
          type: string
          nullable: false
        user:
          $ref: '#/components/schemas/Credentials'
        password:
          $ref: '#/components/schemas/Credentials'
        sql_dialect:
          $ref: '#/components/schemas/SQLDialect'

    Credentials:
      type: object
      title: Credentials
      nullable: true
      properties:
        type:
          type: string
      discriminator:
        propertyName: type
        mapping:
          'raw': '#/components/schemas/RawCredentials'
          'gcp': '#/components/schemas/GcpCredentials'

    RawCredentials:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Credentials"
        - type: object
          properties:
            value:
              type: string

    GcpCredentials:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Credentials"
        - type: object
          properties:
            project:
              type: string
              nullable: false
            secret:
              type: string
              nullable: false
            version:
              type: string

    StopWorkflowResponse:
      type: object
      title: StopWorkflowResponse
      nullable: false
      properties:
        message:
          nullable: false
          type: string
        stop_workflow_run_response:
          $ref: '#/components/schemas/StopWorkflowRunResponse'

    StopWorkflowRunResponse:
      type: object
      title: StopWorkflowResponse
      nullable: true
      properties:
        workflow_run_id:
          nullable: false
          type: integer
          format: int64
        workflow_run_status:
          $ref: '#/components/schemas/WorkflowRunStatus'
        start_date:
          type: string
          format: date-time
          example: "2021-01-30T08:30:00Z"
        end_date:
          type: string
          format: date-time
          example: "2021-01-30T08:30:00Z"
        user_id:
          type: integer
          format: int64
        error_message:
          type: string
        steps:
          description: "Workflow run steps info"
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/WorkflowRunStep"
          default: null

    RunWorkflowResponse:
      type: object
      title: RunWorkflowResponse
      nullable: false
      properties:
        workflow_run_id:
          nullable: false
          type: integer
          format: int64
        workflow_run_status:
          $ref: '#/components/schemas/WorkflowRunStatus'
        start_date:
          type: string
          format: date-time
          example: "2021-01-30T08:30:00Z"
        end_date:
          type: string
          format: date-time
          example: "2021-01-30T08:30:00Z"
        user_id:
          type: integer
          format: int64
        error_message:
          type: string
        steps:
          description: "Workflow run steps info"
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/WorkflowRunStep"
          default: null

    WorkflowStatusRequest:
      type: object
      title: WorkflowStatusRequest
      nullable: false
      properties:
        ids:
          type: array
          nullable: false
          items:
            type: integer
            format: int64
          default: [ ]

    WorkflowStatusResponse:
      type: object
      title: WorkflowStatusResponse
      nullable: false
      properties:
        workflow_id:
          nullable: false
          type: integer
          format: int64
        workflow_run_status:
          $ref: '#/components/schemas/WorkflowRunStatus'

    WorkflowRunStep:
      type: object
      title: WorkflowRunStep
      nullable: false
      properties:
        workflow_run_step_id:
          nullable: true
          type: integer
          format: int64
        workflow_run_id:
          nullable: true
          type: integer
          format: int64
        name:
          $ref: '#/components/schemas/WorkflowRunStepName'
        workflow_run_step_status:
          $ref: '#/components/schemas/WorkflowRunStatus'
        total_time_millis:
          nullable: true
          type: integer
          format: int64

    WorkflowRunStatus:
      enum:
        - QUEUED
        - RUNNING
        - COMPLETED
        - FAILED
        - STOPPED

    WorkflowRunStepName:
      enum:
        - VALIDATION
        - SCHEMA_COPY
        - TRUNCATION
        - TRANSFORMATION

    TransformationParams:
      description: >
        Parameters of the generator. All parameters have a type key with the type name of the transformation, and
        other parameters that are transformation-specific.
      type: object
      nullable: false
      x-extends:
        - java.io.Serializable
      properties:
        type:
          type: string
      discriminator:
        propertyName: type
        mapping:
          'categorical_generator': '#/components/schemas/CategoricalGeneratorParams'
          'conditional_generator': '#/components/schemas/ConditionalGeneratorParams'
          'continuous_generator': '#/components/schemas/ContinuousGeneratorParams'
          'quantile_generator': '#/components/schemas/QuantileGeneratorParams'
          'copy_parent_generator': '#/components/schemas/CopyParentGeneratorParams'
          'foreign_key_generator': '#/components/schemas/ForeignKeyGeneratorParams'
          'unique_generator': '#/components/schemas/UniqueGeneratorParams'
          'format_preserving_hashing': '#/components/schemas/FormatPreservingHashingParams'
          'formatted_string_generator': '#/components/schemas/FormattedStringGeneratorParams'
          'int_sequence_generator': '#/components/schemas/IntSequenceGeneratorParams'
          'string_sequence_generator': '#/components/schemas/StringSequenceGeneratorParams'
          'noising': '#/components/schemas/NoisingParams'
          'null_generator': '#/components/schemas/NullGeneratorParams'
          'passthrough': '#/components/schemas/PassthroughParams'
          'person_generator': '#/components/schemas/PersonGeneratorParams'
          'address_generator': '#/components/schemas/AddressGeneratorParams'
          'redaction': '#/components/schemas/RedactionParams'
          'unique_hashing': '#/components/schemas/UniqueHashingParams'
          'date_generator': '#/components/schemas/DateGeneratorParams'
          'constant_date_generator': '#/components/schemas/ConstantDateGeneratorParams'
          'uuid_generator': '#/components/schemas/UuidGeneratorParams'
          'constant': '#/components/schemas/ConstantGeneratorParams'

    NumericType:
      nullable: true
      default: null
      enum:
        - INT
        - LONG
        - DOUBLE
        - FLOAT
        - BIG_DECIMAL
        - BIG_INTEGER
        - SHORT

    QuantileGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            hist:
              type: array
              items:
                type: number
                format: double
                nullable: false
              default: null
              nullable: true
            bin_edges:
              type: array
              items:
                type: number
                format: double
                nullable: false
              default: null
              nullable: true
            numeric_type:
              $ref: '#/components/schemas/NumericType'

    ContinuousGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            mean:
              type: number
              format: double
              nullable: true
            std:
              type: number
              format: double
              nullable: true
            min:
              type: number
              format: double
              nullable: true
            max:
              type: number
              format: double
              nullable: true
            numeric_type:
              $ref: '#/components/schemas/NumericType'
            round:
              type: integer
              nullable: false
              default: 0


    IntSequenceGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            start_from:
              type: integer
              default: 0
              nullable: false

    StringSequenceGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            length:
              type: integer
              nullable: true

    NullGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"

    UuidGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"

    Action:
      nullable: false
      enum:
        - KEEP
        - MASK

    Position:
      nullable: false
      enum:
        - FIRST
        - LAST

    RedactionParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            action:
              $ref: '#/components/schemas/Action'
            which:
              $ref: '#/components/schemas/Position'
            count:
              type: integer
              nullable: false
              default: 4
            mask_with:
              type: string
              nullable: false
              default: '*'

    PassthroughParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object

    CopyParentGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            parent_columns:
              type: array
              items:
                type: string
                nullable: false
              default: []
              nullable: false
            parent_tables:
              type: array
              items:
                type: string
                nullable: false
              default: []
              nullable: false

    DateGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            mean:
              type: string
              format: date-time
              nullable: true
            std:
              description: standard deviation in milliseconds
              type: integer
              nullable: true
            min:
              type: string
              format: date-time
              nullable: true
            max:
              type: string
              format: date-time
              nullable: true

    ConstantDateGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            min:
              type: string
              format: date-time
              nullable: true
            max:
              type: string
              format: date-time
              nullable: true

    ForeignKeyGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            referred_schema:
              type: string
              nullable: true
            referred_table:
              type: string
              nullable: true
            referred_fields:
              type: array
              items:
                type: string
                nullable: false
              nullable: true

    UniqueGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            params:
              type: array
              items:
                $ref: "#/components/schemas/TransformationParams"
              default: null
              nullable: true

    NoisingParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            sensitivity:
              type: number
              format: double
              nullable: true
            min:
              type: number
              format: double
              nullable: true
            max:
              type: number
              format: double
              nullable: true

    FormattedStringGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            pattern:
              type: string
              nullable: true

    ConditionalGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            conditional_column:
              type: string
              nullable: false
            conditional_table:
              type: string
              nullable: true
            conditional_value:
              type: string
              nullable: false
            if_false:
              $ref: '#/components/schemas/TransformationParams'
            if_true:
              $ref: '#/components/schemas/TransformationParams'

    FormatPreservingHashingParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"

    PersonGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            column_templates:
              type: array
              items:
                type: string
                nullable: false
              nullable: false
            consistent_with_column:
              type: string
              nullable: true
            locale:
              type: string
              nullable: false
              default: 'en'

    AddressGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            column_templates:
              type: array
              items:
                type: string
                nullable: false
              nullable: false
            consistent_with_column:
              type: string
              nullable: true
            locale:
              type: string
              nullable: false
              default: 'en-GB'

    CategoricalGeneratorParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            categories:
              $ref: "#/components/schemas/Categories"
            probabilities:
              type: array
              items:
                type: number
                format: double
                nullable: false

    UniqueHashingParams:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            max_value:
              type: number
              format: double
              default: null
              description: "Max value to generate, null means absence of limit"
            precision:
              type: integer
              default: null
              description: "Max precision to generate (e.g. if the value is 3, the maximal value is 999),
              null means absence of limit. Minimal value is applied if both max_value and precision are specified"

    ConstantGeneratorParams:
      description: "Params to generate a single value for the entire column"
      nullable: false
      allOf:
        - $ref: "#/components/schemas/TransformationParams"
        - type: object
          properties:
            value:
              type: number
              nullable: false
            numeric_type:
              $ref: '#/components/schemas/NumericType'

    Condition:
      description: >
        Condition on which the default parameters are being applied.
      type: object
      nullable: false
      properties:
        type:
          type: string
      discriminator:
        propertyName: type
        mapping:
          'is_key': "#/components/schemas/IsKeyCondition"
          'is_primary_key': "#/components/schemas/IsPrimaryKeyCondition"
          'is_foreign_key': "#/components/schemas/IsForeignKeyCondition"
          'is_ignored_foreign_key': "#/components/schemas/IsIgnoredForeignKeyCondition"
          'is_unique': "#/components/schemas/IsUniqueCondition"
          'mode_in': "#/components/schemas/ModeInCondition"
          'true': "#/components/schemas/TrueCondition"
          'data_type': "#/components/schemas/DataTypeCondition"
          'unique_values': "#/components/schemas/UniqueValuesCondition"
          'is_empty': "#/components/schemas/IsEmptyCondition"
          'parent_transformation': "#/components/schemas/ParentTransformationParamsCondition"
          'is_uuid': "#/components/schemas/IsUuidCondition"
          'single_distinct_value': "#/components/schemas/SingleDistinctValueCondition"

    IsForeignKeyCondition:
      description: >
        The column is a part of a foreign key.
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Condition"

    IsIgnoredForeignKeyCondition:
      nullable: false
      description: Applied to columns that are the part of FK which is ignored due to cycles
      allOf:
        - $ref: "#/components/schemas/Condition"

    IsUniqueCondition:
      description: >
        The column is either a part of primary key or `UNIQUE` constraint.
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Condition"

    TransformationDataType:
      nullable: false
      enum:
        - TEXT
        - NUMERIC
        - DATE
        - BOOLEAN
        - ANY

    DataTypeCondition:
      description: >
        The column has one of the given data types.
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Condition"
        - type: object
          properties:
            data_type:
              $ref: "#/components/schemas/TransformationDataType"

    IsEmptyCondition:
      description: >
        The column is empty.
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Condition"

    UserTransformationMode:
      description: >
        Defines table processing mode.

         `KEEP`:: if this mode is selected, the original data will be copied as it is. When this mode is selected, the
         output size needs to be smaller than the input, i.e. `target_ratio ++<= 1++`.

         `MASKING`:: if this mode is selected, masking transformations will be applied to the original data.
         When this mode is selected, the output size needs to be smaller than the input, i.e. `target_ratio ++<= 1++`.

         `GENERATION`:: if this mode is selected, the synthesized engine will learn the original data and generate
         new synthetic data. For this mode, the output database can be bigger than the input, so `target_ratio` can
         be greater than 1.


        NOTE: Both `KEEP` and `MASKING` modes apply a transformation to original data. While KEEP uses passthrough as
        default transformation, while MASKING automatically assigns a privacy preserving masking transformation to all
        columns. See transformations list for more details. For all modes, the user can override default transformers.

      nullable: true
      enum:
        - MASKING
        - GENERATION
        - KEEP

    ModeInCondition:
      description: >
        The transformation mode is in a given array.
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Condition"
        - type: object
          properties:
            modes:
              type: array
              items:
                $ref: "#/components/schemas/UserTransformationMode"
              nullable: false

    IsPrimaryKeyCondition:
      description: >
        The column is a part of a primary key.
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Condition"

    IsKeyCondition:
      description: >
        The column is a part of either primary or a foreign key.
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Condition"

    IsUuidCondition:
      description: >
        The column is of UUID type.
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Condition"

    SingleDistinctValueCondition:
      description: >
        The column contains only one distinct value.
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Condition"

    TrueCondition:
      description: >
        Always true, thus making the rule applicable to every column.
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Condition"

    UniqueValuesCondition:
      description: >
        Check whether the given field can be modelled as a <<FormatPreservingHashingParams, format preserving hashing>>
        column instead of categorical.
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Condition"
        - type: object
          properties:
            unique_ratio_threshold:
              description: >
                The fraction of unique values.
              type: number
              format: double
              nullable: false
              default: 0.5
            min_table_size_threshold:
              description: >
                Minimum table size, as for small tables the `unique_ratio_threshold` can lead
                to false positives.
              type: integer
              nullable: false
              default: 10

    ParentTransformationParamsCondition:
      description: "
 If the field refers to a FK, check whether the parent column is transformed by a specific transformer"
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Condition"
        - type: object
          properties:
            parent_transformation_params:
              $ref: "#/components/schemas/TransformationParams"

    ColumnTransformationParams:
      description: >

        List of column names associated with <<TransformationParams>>.
      type: object
      nullable: false
      x-extends:
        - java.io.Serializable
      properties:
        columns:
          description: >
            List of columns that are affected by this generator.
          type: array
          items:
            type: string
            nullable: false
          nullable: false
        params:
          $ref: "#/components/schemas/TransformationParams"

    UserTableConfig:
      description: >
        The parameters defined in the default configuration are applied to all
        tables in the database, so there's no need to configure each table
        individually. But if needed, the user can override default configuration
        for any specific table present in the database.

        For each table, the user can create a `UserTableConfig` and add it to
        the list `user_table_configs` of `<<UserConfig>>`.

      type: object
      nullable: false
      x-extends:
        - java.io.Serializable
      properties:
        table_name_with_schema:
          description: >
            The name of the table affected by this `UserTableConfig`. Must be in format `$schema.$table`, and the
            table must exist in the database.
          type: string
          nullable: false
        mode:
          $ref: "#/components/schemas/UserTransformationMode"
        column_params:
          type: array
          items:
            $ref: "#/components/schemas/ColumnTransformationParams"
          default: []
          nullable: false
        target_ratio:
          description: >
            The relative size of the output database with respect to the input. The number of rows of each output table
            will be computed by multiplying this parameter by the input table size. If not provided, this parameter will
            be `target_ratio = 1`, resulting on same size for input and output databases.


            NOTE: When setting target_ratio at a table level, the result may end up being smaller than the given value
            due to relationships with parent table. For example, if a customer table is set to `target_ratio = 0.5`,
            and its child table transactions has `target_ratio = 1.0`, the output transaction table will also end with
            half it’s samples due to its downstream dependency to the reduced table customer.

          type: number
          format: double
          nullable: true
        cycle_breaker_references:
          type: array
          description: >
            When `<<CycleResolutionStrategy>>` is `FAIL`, this list may contain a list of table names, references
            to which will be ignored during the data generation.
          items:
            type: string
            nullable: false
          nullable: false
          default: []
        insert_batch_size:
          description: >
            Indicates how many table rows are inserted to the database per each batch operation.
          type: integer
          nullable: true

    TransformationMode:
      nullable: false
      enum:
        - MASKING
        - GENERATION

    TableConfig:
      description: "[TableConfig] is equivalent to [UserTableConfig] but with all parameters must set,
       it doesn't accept null values."
      type: object
      nullable: false
      x-extends:
        - java.io.Serializable
      properties:
        table:
          $ref: "#/components/schemas/Table"
        mode:
          $ref: "#/components/schemas/TransformationMode"
        column_params:
          type: array
          items:
            $ref: "#/components/schemas/ColumnTransformationParams"
          nullable: false
        target_ratio:
          type: number
          format: double
          nullable: false
        cycle_breaker_references:
          type: array
          nullable: false
          items:
            type: string
            nullable: false
          default: [ ]
        target_count:
          type: integer
          format: int64
          nullable: false
          default: 0
        insert_batch_size:
          type: integer
          nullable: false

    DefaultConfigItem:
      description: >
        The rule that applies to the tables by default, written in form "if given <<Condition,conditions>> are met,
        the given `<<TransformationParams>>` are applied."
      type: object
      nullable: false
      properties:
        conditions:
          description: >
            The list of conditions that must be met in order for the transformation params to be applied.
          type: array
          items:
            $ref: "#/components/schemas/Condition"
          nullable: false
        transformation:
          $ref: "#/components/schemas/TransformationParams"

    DefaultConfig:
      description: >
        Consists of the the default table configuration parameters that are applied to all tables by default
        and a list of <<DefaultConfigItem,rules>> that are conditionally applied to the table.
      type: object
      nullable: true
      default: 'null'
      properties:
        mode:
          $ref: "#/components/schemas/UserTransformationMode"
        target_ratio:
          description: >
            The relative size of the output database with respect to the input. The number of rows of each output table
            will be computed by multiplying this parameter by the input table size. If not provided, this parameter will
            be target_ratio = 1, resulting on same size for input and output databases.
          type: number
          format: double
          nullable: false
          default: 1.0
        insert_batch_size:
          type: integer
          nullable: true
          description: >
            Indicates how many table rows are inserted to the database per each batch operation.
        items:
          type: array
          items:
            $ref: "#/components/schemas/DefaultConfigItem"
          nullable: false
          default: [ ]

    CycleResolutionStrategy:
      description: >
       Defines how to deal with cycles in table relations via foreign keys.

        `FAIL`:: if this mode is selected, `cycle_breaker_references` should be provided in the configuration file.
          Otherwise, execution will fail if it detects a circular reference.

        `DELETE_NOT_REQUIRED`::  if this mode is selected, cyclic references will be resolved automatically
        by removing the last nullable reference leading to the cycle.

      nullable: true
      default: null
      enum:
        - FAIL
        - DELETE_NOT_REQUIRED

    UserConfig:
      description: >
        To execute a workflow, the user can provide a YAML configuration file to fine-tune parameters
        of the transformations. `UserConfig` is the root object of this configuration file.


        This object consists of a <<DefaultConfig,default configuration>> and a list of `<<UserTableConfig>>`.
      type: object
      nullable: false
      properties:
        default_config:
          $ref: "#/components/schemas/DefaultConfig"
        user_table_configs:
          type: array
          items:
            $ref: "#/components/schemas/UserTableConfig"
          nullable: false
          default: []
        cycle_resolution_strategy:
          $ref: "#/components/schemas/CycleResolutionStrategy"
        schema_creation_mode:
          $ref: "#/components/schemas/SchemaCreationMode"
        table_truncation_mode:
          $ref: "#/components/schemas/TableTruncationMode"
        global_seed:
          description: >
            A value used a seed for random number generators. The result of generation must be the same each time
            the generation is being run with the same seed and workflow configuration. By default `global_seed` is 0.
          type: integer
          nullable: true

    SchemaCreationMode:
      description: >
         Defines the mode of schema creation.

          `CREATE_IF_NOT_EXISTS`:: if this mode is selected, DDL schema will be copied from the source database to the
          target one if it does not exist, existing schema will be used otherwise.

          `DO_NOT_CREATE`:: if this mode is selected, the existing schema will be used without any validations. Please
          use this mode carefully: run-time errors may occur if the input and output schema do not match.

          `CREATE`:: if this mode is selected, DDL schema will be copied from the source database to the target one.
          The target database should be empty.

          `DROP_AND_CREATE`:: if this mode is selected, DDL schema will be copied from the source database to the
          target one. Existing schema in the target database will be dropped. Please use this mode carefully.

      nullable: true
      default: null
      enum:
        - DO_NOT_CREATE
        - CREATE
        - CREATE_IF_NOT_EXISTS
        - DROP_AND_CREATE

    TableTruncationMode:
      description: >
        Defines the mode of table truncation.

          `DO_NOT_TRUNCATE`:: (default) if this mode is selected, tables in the target database won’t be truncated.
           An empty target database required.

          `TRUNCATE`:: if this mode is selected, tables in the target database will be truncated.

          `IGNORE`:: if this mode is selected, the status of the target database is ignored.


      nullable: true
      default: null
      enum:
        - DO_NOT_TRUNCATE
        - TRUNCATE
        - IGNORE

    TableConfigRequest:
      nullable: false
      type: object
      properties:
        input_connection:
          $ref: '#/components/schemas/DatabaseConnection'
        config:
          nullable: false
          type: string

    Categories:
      type: object
      title: Category for Categorical Generator
      nullable: true
      properties:
        type:
          type: string
      discriminator:
        propertyName: type
        mapping:
          'string': '#/components/schemas/StringCategories'
          'boolean': '#/components/schemas/BooleanCategories'

    StringCategories:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Categories"
        - type: object
          properties:
            values:
              type: array
              nullable: false
              default: []
              items:
                type: string
                nullable: true
    BooleanCategories:
      nullable: false
      allOf:
        - $ref: "#/components/schemas/Categories"
        - type: object
          properties:
            values:
              type: array
              nullable: false
              default: []
              items:
                type: boolean
                nullable: true

    LicenseExpiration:
      nullable: false
      type: object
      properties:
        expiry_date:
          type: string
          format: date