hunk.code_window:   -- 'Int' we should be able to join this with a remote node, which expects an
     -- input argument of type '[Int]'
     -- http://spec.graphql.org/June2018/#sec-Type-System.List
     case (isListType' actualType,isListType' expectedType) of
       (True, True) -> assertType (unwrapTy actualType) (unwrapTy expectedType)
       (True, False) -> Failure (pure $ ExpectedTypeButGot expectedType actualType)
       _ ->
         (when
          (getBaseTy actualType /= getBaseTy expectedType)
          (Failure (pure $ ExpectedTypeButGot expectedType actualType)))
     pure ()
   assertListType :: G.GType -> Validation (NonEmpty ValidationError) ()
   assertListType actualType =
     (when (not $ isListType' actualType)
  
hunk.labels: keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep
hunk.after_edit:   let (actualBaseType, actualNestingLevel) = getBaseTyWithNestedLevelsCount actualType
         (expectedBaseType, expectedNestingLevel) = getBaseTyWithNestedLevelsCount expectedType
     in
     if actualBaseType == expectedBaseType
     then if (actualNestingLevel == expectedNestingLevel || actualNestingLevel == 0)
     -- The check of 'actualNestedCount == 0' is the case of coercing a singleton type
     -- into an array type
          then pure ()
          else Failure (pure $ ExpectedTypeButGot expectedType actualType)
          --  we cannot coerce two types with different nesting levels,
          -- for example, we cannot coerce [Int] to [[Int]]
     else Failure (pure $ ExpectedTypeButGot expectedType actualType)
  
hunk.file_path: server/src-lib/Hasura/RQL/DDL/RemoteRelationship/Validate.hs
hunk.type: replace
file: import React from 'react';
  import { ordinalColSort } from '../utils';
  import { addRelViewMigrate, resetManualRelationshipForm } from './Actions';
  import ExpandableEditor from '../../../Common/Layout/ExpandableEditor/Editor';
  import ManualRelationshipSelector from './ManualRelationshipSelector';
  import {
    getColumnName,
    getSchemaName,
    getSchemaTables,
    getTableColumnNames,
    getTableName,
    getTableSchema,
    getTrackedTables,
  } from '../../../Common/utils/pgUtils';
  
  const AddManualRelationship = ({
    tableSchema,
    allSchemas,
    schemaList,
    relAdd,
    dispatch,
  }) => {
    const styles = require('../TableModify/ModifyTable.scss');
  
    const columns = tableSchema.columns.sort(ordinalColSort);
  
    // columns in the right order with their indices
    const orderedColumns = columns.map((c, i) => ({
      name: getColumnName(c),
      index: i,
    }));
  
    relAdd.rSchema = relAdd.rSchema || getTableSchema(tableSchema);
  
    const refTables = {};
    const trackedSchemaTables = getTrackedTables(
      getSchemaTables(allSchemas, relAdd.rSchema)
    );
    trackedSchemaTables.forEach(
      ts => (refTables[getTableName(ts)] = getTableColumnNames(ts))
    );
  
    const orderedSchemaList = schemaList.map(s => getSchemaName(s)).sort();
  
    const resetManualRel = () => {
      dispatch(resetManualRelationshipForm());
    };
  
    const saveFk = toggleEditor => {
      dispatch(addRelViewMigrate(tableSchema, toggleEditor));
    };
  
    const expandedContent = () => (
      <ManualRelationshipSelector
        tableSchema={tableSchema}
        relAdd={relAdd}
        schemaList={orderedSchemaList}
        refTables={refTables}
        orderedColumns={orderedColumns}
        dispatch={dispatch}
      />
    );
  
    const expandedLabel = () => {
      return <b>Configure relationship</b>;
    };
  
    return (
      <div key="add_manual_relationship">
        <div className={styles.add_mar_bottom}>
          Add a new relationship <b>manually</b>
        </div>
        <ExpandableEditor
          editorExpanded={expandedContent}
          expandedLabel={expandedLabel}
          expandButtonText="Configure"
          collapseCallback={resetManualRel}
          saveFunc={saveFk}
          service="create"
          property="manual-rel"
        />
      </div>
    );
  };
  
  export default AddManualRelationship;
  