---
schema_version: "1"
id: f8340ad2ed7b3de0fa1fa3f56df3a915fe508ed7913b21820af706f5eb14d2dd
title: Creating and Editing Object Type Merges
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/datagraph/manage-merges.md
canonical_url: https://docs.mulesoft.com/datagraph/manage-merges
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 37cbbef02a1de77e41616960758087aaf97a315c43454d59241ff77279e36166
description: MuleSoft Documentation Site
latest: true
---
---
product: DataGraph
---

# Creating and Editing Object Type Merges

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

The following tasks explain how to create and undo merges within the unified schema and within the
local schema.

## Merge Object Types

Merging object types enables you to combine the fields of two similar object types and create more
valuable results from a single query.

You can merge object types locally within the same API schema, or merge an object type with a type
in the unified schema.

Ensure object types you want to merge are [set to visible](https://docs.mulesoft.com/datagraph/manage-elements-visibility).

To merge object types:

1.  In the API schema navigation, select the object type you want to merge.

2.  In the **Merge** pane, select the target type to merge with.

    The following example merges the current type, called **OrderSummary**, with a target object
    type called **OrderResponse**:

    ![Selecting the target type order response to merge with the order summary type](/mulesoft/current/en-us/datagraph/_images/merge-selection.png)

    The target type does not need to have the same name.

3.  If the current type allows collaboration but collaboration is not yet enabled, and if the
    selected target type has a primary key defined, make one of the following selections:

    - (Recommended) Join fields from the two types to have a more enriched query result for this
      type.

      If you make this selection, you are taken to the **Enable collaboration** pane, where you set
      a default query method and a primary key, or two primary keys if the query method uses
      composite keys. (Refer to [Enable Collaboration on a Type](https://docs.mulesoft.com/datagraph/collaboration) for more information
      about object type collaboration.)

    - Declare the current type as a reference so that it returns only the fields and dataset of the
      type it’s merged with.

4.  In the **Merge with another type** pane, click **Preview merge** results.

    In the following example, the preview shows the target **OrderResponse** object type in the
    unified schema, including the new fields added after the **OrderSummary** object type is merged
    with **OrderResponse**:

    ![Merge preview results for order summary and order response merge](/mulesoft/current/en-us/datagraph/_images/merge-preview.png)

5.  To finish, click **Confirm merge**:

After you apply your changes, the resulting object type in the unified schema indicates the merge,
as shown:

![Merge preview results indicator](/mulesoft/current/en-us/datagraph/_images/merged-type-results.png)

## Undo Merges Between Object Types

You can undo merges between object types as needed. For example, if you want to merge Object Type A
with Object Type C, but Type A has already been merged with Type B in the unified or local API
schema, you must undo the existing merge between Types A and B before creating a new merge with Type
C.

Note the following:

- Undoing a merge will break existing queries of the merged type.

- If you undo a merge between Object Type A and Type B in the unified schema, you must rename Object
  Type A (and its query method, if merged). Anypoint DataGraph displays a conflict until Object Type
  A (and its query method) are renamed or merged again with Type B.

- Nullable fields return to their original state after you undo a merge. For example, if a field in
  an object type was non-nullable, but as a result of a merge became nullable, then the field
  returns to being non-nullable after you undo the merge.

To undo a merge:

1.  From the unified schema, click **List of APIs added** and select the API that contains the
    merged object type.

2.  In the API schema navigation, select the object type and scroll to the **Merge** pane.

3.  Click **Undo merge**.

4.  Click **Apply Changes**.

## Split a local merge

Split local merges to resolve conflicts, manage element visibility, rename fields, or perform other
edits on your local API schema.

If you have object types that are merged locally and merged with a type in the unified schema,
you’ll first need to undo the merge with the unified schema.

To split a merge:

1.  Click **List of APIs added** and select the API schema that contains the object type to unmerge.

2.  In the API schema navigation, select the object type and scroll to the Merge pane.

3.  Click **Split Local Merge** > **Apply Changes**.

After the split, the types return to their original states but retain any customizations, such as
field visibility changes or new names.

## Additional Resources

- [Resolve Conflicts and Merge Inconsistencies](https://docs.mulesoft.com/datagraph/resolve-conflicts)

- [How Object Type Merges Work in Anypoint DataGraph](https://docs.mulesoft.com/datagraph/merge-types)
