Skip to content

Get what merging an import would do

GET
/imports/{importId}/plan
curl --request GET \
--url https://api.modeldesk.io/imports/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/plan \
--header 'Authorization: Bearer <token>'

What merging an import that waits for review into the branch it goes into would do, computed as the branch merge computes it with the model’s import line, held to the import’s commit, as its source; nothing is written and nothing is stored, so every read computes it again. changes is the diff from the branch’s head to the state the merge would land with every conflict standing as the branch holds it, in the shape the branch diff route answers, owners whose members changed and the closure’s elements included, so a review places each change as it does for a branch: a change the branch already holds, such as a pin both sides share, is not listed, and importing the unchanged file lists nothing. counts counts the changes a merge selection can act on. conflicts, resolvedNames, closureChanges and blockers are the merge preview’s; blockers is always empty for a caller who may read the model and may not write it. sourceName and createdBy are sent only to a caller who may read the import by its own access rules, as on the model’s source route.

Needs read access to the model the import goes into; an unknown import and one into a model the caller may not read answer the same 404. An import whose parse is not on the import line yet is prepared on this read for a caller who may write the model: at once for the person who created the import, and for any other writer once it has gone unprepared for ten minutes. The commit is always the creator’s. A reader’s read writes nothing.

An import that is not waiting for review has no plan and is answered with its state as ImportNotMergeableProblem: not-prepared (its file is still being read, or its parse is not on the import line yet), superseded (a newer import into the model committed on top of it), merged (with mergeCommitId when its merge landed a commit), failed (with the import’s errorMessage for a caller who may read the import by its own access rules), deleted (it was discarded), or creates-model (it creates a model rather than going into one).

importId
required
string format: uuid

OK

Media typeapplication/json

What merging an import that waits for review into the branch it goes into would do, computed as the merge computes it with nothing written.

object
importId
required
string format: uuid
targetBranch
required

The branch the import goes into.

object
id
required
string format: uuid
name
required
string
mergeBaseId
required

The common ancestor of the branch’s head and the import’s commit; the import’s commit itself when the branch already holds it.

string format: uuid
targetCommitId
required

The branch’s head the plan was computed from, which a merge may hold as expectedHeadId.

string format: uuid
sourceCommitId
required

The import’s commit on the model’s import line, the merge commit’s second parent, which a merge may send as expectedSourceHeadId.

string format: uuid
changes
required

The changes the merge would make to the branch, from its head (parentCommitId) to the state the merge would land with every conflict standing as the branch holds it; commitId is the import’s commit. elements is left out when it is empty, as on the branch diff.

object
commitId
required
string format: uuid
parentCommitId

Null for initial commits.

string format: uuid
elements
required
Array<object>
object
elementId
required
string format: uuid
elementName

Element name resolved at commit time.

string
elementType
required
string
diffType
required
string
Allowed values: ADDED MODIFIED REMOVED
attributes

Changed attributes only.

object
key
additional properties
object
before

Attribute values before the change. Null for ADDED elements.

Array
after

Attribute values after the change. Null for REMOVED elements.

Array
relations

Changed relations only.

object
key
additional properties

One relation that differs between the two states. before and after carry the relation whole, so a reader can show the targets it kept beside the ones it gained or lost, and a relation whose targets were only reordered differs in them alone. An empty list is omitted: an ADDED element’s relation carries no before, a REMOVED element’s no after.

object
before

Element IDs of the relation’s targets before the change, in order.

Array<string>
after

Element IDs of the relation’s targets after the change, in order.

Array<string>
addedTargets

Element IDs of newly added relation targets.

Array<string>
removedTargets

Element IDs of removed relation targets.

Array<string>
resolvedNames

Display label by element ID for every element the diff names: each entry, every target a changed relation holds before or after the change, and the elements its diagram actions name. An element neither state nor the current model holds is left out.

object
key
additional properties
string
landed
required

Every element of the state the merge would land whose stored form differs from the branch’s head, whole, by id, in the form a model state gives its elements. Laid over the branch’s state at targetCommitId, with the elements changes lists as REMOVED taken away, it gives the landing state exactly: each element changes lists as added or modified, owners whose members changed included, and any element whose stored form differs in what a diff entry does not show, such as a reference’s owned flag or group. With conflicts, the landing state is the one with every conflict standing as the branch holds it, as for changes. Empty when nothing would change.

object
key
additional properties
object
id
required
string format: uuid
type
required
string
external
boolean
attributes
object
key
additional properties
array
relations
object
key
additional properties
object
key
additional properties
Array<object>
object
id
required
string format: uuid
owned
required
boolean
modelId

Owning model of the referenced element when it differs from the containing model (cross-model reference, e.g. a lineage base element). Omitted for same-model references.

string format: uuid
extensionLayer

The values the element holds that its type declares no property for; absent when none.

Array

A value an element holds under no binding its type declares, kept so a round trip loses nothing.

One of: discriminator: kind
attribute
object
kind
required
string
Allowed value: attribute
key
string
lexicalValue
string
typeIdentifier
string
qualifiers
object
key
additional properties
string
lineage

Where an element was derived from: the source and rules models, and per property the source values it read.

object
sourceModels
Array<object>
object
modelId
string format: uuid
commitId
string format: uuid
rulesModels
Array<object>
object
modelId
string format: uuid
commitId
string format: uuid
generatedBy
object
id
required
string format: uuid
owned
required
boolean
modelId

Owning model of the referenced element when it differs from the containing model (cross-model reference, e.g. a lineage base element). Omitted for same-model references.

string format: uuid
properties
Array<object>
object
propertyName
string
propertyType
string
Allowed values: ATTRIBUTE RELATION
sources
Array<object>
object
sourceModelId
string format: uuid
sourceElementId
string format: uuid
sourceProperty
string
propertyType
string
Allowed values: ATTRIBUTE RELATION
role
string
Allowed values: PRIMARY VALUE_READ
usedRule
object
id
required
string format: uuid
owned
required
boolean
modelId

Owning model of the referenced element when it differs from the containing model (cross-model reference, e.g. a lineage base element). Omitted for same-model references.

string format: uuid
conflicts
required
Array<object>

One element a merge could not take from either branch, why, and what each branch holds for it: enough to choose a side without reading either branch. The names of the elements its values reference are on the problem’s resolvedNames.

object
elementId
required
string format: uuid
target
required

What the branch merged into holds for the element.

object
present
required

Whether the branch holds the element at all.

boolean
type

The element’s type on that branch, absent when it does not hold the element. An element the two branches hold as different types is resolved by taking one side whole.

string
owners
required

The ids of the elements that own it on that branch, in id order. Empty for the model’s root, and for an element the branch does not hold. Two branches that placed one element under different owners show it here, with nothing among its fields to tell them apart; taking the element from a side places it under that side’s owners. resolvedNames names them.

Array<string>
source
required

What the branch merged from holds for the element.

object
present
required

Whether the branch holds the element at all.

boolean
type

The element’s type on that branch, absent when it does not hold the element. An element the two branches hold as different types is resolved by taking one side whole.

string
owners
required

The ids of the elements that own it on that branch, in id order. Empty for the model’s root, and for an element the branch does not hold. Two branches that placed one element under different owners show it here, with nothing among its fields to tell them apart; taking the element from a side places it under that side’s owners. resolvedNames names them.

Array<string>
fields
required

Every attribute and relation the target’s and the source’s version hold differently, attributes first and each kind by key. A relation counts as held differently when its groups or the ownership of its references differ too, even where its target ids read the same. A side that does not hold the element has no values, so every field the other side holds is listed. Empty when the two versions differ in nothing a field carries, such as their type or their owners alone. A pinned-differently conflict lists the pin alone, as one field, @commitId, or @location for an external dependency, whose values are the pins as a reader names them: the version name where the pin is a release, otherwise Snapshot followed by the first eight characters of the pinned commit’s id, and for an external dependency its document, the address or the name an upload arrived under with the first eight characters of its content’s hash. A pin is taken whole: a resolution taking fields of one takes the side it names for that field, and the target’s where it names none.

Array<object>

One attribute or relation of a conflicting element, as the merge base, the target and the source hold it. A value is absent where that version does not hold the key or the element; a stored empty value reads as absent.

object
key
required

The attribute or relation key, as the element stores it.

string
kind
required

Whether the key is one of the element’s attributes or one of its relations.

string
Allowed values: attribute relation
base

The value at the merge base, absent where the base did not hold the element or the key. Shaped as target is.

Array
target

The value on the branch merged into. An attribute’s value is the list of values it stores; a relation’s is the ids of its targets, group after group, in stored order, which resolvedNames names.

Array
source

The value on the branch merged from, shaped as target is.

Array
managedDependencyChanges

On a pinned-differently conflict on the pin of the model’s metamodel or of one of its extensions only: how many managed dependencies of the branch merged into each side’s pin changes. The built-in elements a pin brings along follow the pin, so they are never conflicts of their own.

object
target
required

How many taking the target’s pin changes, which is none, as they already follow it.

integer
source
required

How many taking the source’s pin changes.

integer
reason
required

both-changed: both branches changed the element, differently. changed-and-deleted: one branch deleted it and the other changed it. owner-deleted: one branch created or changed it under an owner the other deleted, which is also the reason when the other deleted the element together with that owner. target-deleted: one branch changed it while it references an element the other deleted. pinned-differently: the element is a dependency, or the model’s metamodel or extension pin, and the two branches pin it at different commits; taking a side takes that side’s pin, and the dependencies it brings along follow it rather than being reported on their own. dependency-removed: the element refers to content of a dependency the other branch removed, so the merged model would hold a reference nothing resolves; a reference that resolved neither at the merge base nor on either branch was already dangling and is not reported. An element is reported once. An inverse relation is written into both of its ends, so one added on one side to an element the other side changed is both-changed. An owned member added on one side to an owner the other side changed is not: member lists combine, and the owner is both-changed only when both sides changed something other than its member lists, differently.

string
Allowed values: both-changed changed-and-deleted owner-deleted target-deleted pinned-differently dependency-removed
resolvedNames
required

The display name of every element the conflicts name, by id.

object
key
additional properties
string
closureChanges
required
Array<object>

One change a merge would make to the dependencies of the branch it lands on. A pin is named as a reader names it: the version name where the pin is a release, and otherwise Snapshot followed by the first eight characters of the pinned commit’s id. An external dependency’s pin is its document: the address it is read from, or the name an upload arrived under followed by the first eight characters of its content’s hash.

object
kind
required

added: the merge adds a dependency the branch does not declare. removed: it removes one the branch declares. repinned: it moves one the branch declares to another pin. metamodel-repinned: it moves the pin of the model’s metamodel. extension-repinned: it moves the pin of one of the model’s metamodel extensions, named by the extension. A dependency the model holds only because another brings it along, and a managed one, follows what is declared and pinned and is never named on its own.

string
Allowed values: added removed repinned metamodel-repinned extension-repinned
name
required

The name of the model depended on, of the document an external dependency reads, or of the metamodel or extension whose pin moves.

string
from

The pin the branch merged into holds. Present on a repin, absent on an addition, and optional on a removal.

string
to

The pin the merge lands. Present on an addition and a repin, absent on a removal.

string
blockers
required

What would refuse the merge on grounds no choice of side resolves, as the merge preview names it; always empty for a caller who may not write the model.

Array<string>
counts
required

How many changes merging an import would make to its branch, by kind, and how many conflicts there are. Counted by the rule a merge selection acts on, so each counted change is one a selection can leave out: an element added, removed, moved, or changed in a field or in the order of its members. An owner whose only difference is which members it holds is not counted (its members are), and neither are dependency edges, external placeholders or the root’s dependency list, which closureChanges reports. changes lists more than is counted, in the shape the branch diff route answers, so a review can place every change.

object
added
required
integer
changed
required

Elements changed where they stand.

integer
removed
required
integer
moved
required

Elements moved to another owner, changed or not.

integer
conflicts
required
integer
scope
required

How much of the model the file speaks for; every import into a model is whole.

string
Allowed values: whole
sourceName

The file name or address the import read, in the form the source route sends it. Absent when the caller may not read the import by its own access rules.

string
createdBy
object
id
required
string format: uuid
name
string
createdAt

When the import was made.

string format: date-time

Example

{
"changes": {
"elements": [
{
"diffType": "ADDED"
}
]
},
"landed": {
"additionalProperty": {
"extensionLayer": [
{
"kind": "attribute"
}
],
"lineage": {
"properties": [
{
"propertyType": "ATTRIBUTE",
"sources": [
{
"propertyType": "ATTRIBUTE",
"role": "PRIMARY"
}
]
}
]
}
}
},
"conflicts": [
{
"fields": [
{
"kind": "attribute"
}
],
"reason": "both-changed"
}
],
"closureChanges": [
{
"kind": "added"
}
],
"scope": "whole"
}

The caller is an agent acting for a person and the organization that owns the model the import goes into has not enabled the agent’s AI platform, answered as AgentPlatformNotEnabledProblem.

Media typeapplication/problem+json
Any of:

A Problem answered when an agent acting for a person reached a model whose owning organization has not enabled the AI platform the agent runs on, which its token names. Model content reaches the platform an agent runs on, so the organization decides: until an organization admin turns the platform on in the organization’s AI agent platforms setting, every route on the model refuses the agent, conditional reads and the events stream included, and the model list and every page that names other models leave the organization’s models out. A change of the setting applies to new requests within a minute; an events stream that is already open ends at its token’s expiry, at most ten minutes later.

object
type
required

Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.

string
violations

Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.

Array<object>
object
property
required
string
message
required
string
type
required

Stable constant a client branches on, which is what tells this 403 from the plain one the same routes answer for a model the caller may not read.

string format: uri
Allowed values: https://modeldesk.io/problems/agent-platform-not-enabled

Example

{
"type": "https://modeldesk.io/problems/agent-platform-not-enabled"
}

No such import, or one into a model the caller may not read, or, for one that creates a model, one the caller may not read by its own access rules.

Media typeapplication/problem+json

An RFC 9457 problem document, always sent as application/problem+json.

object
type

Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.

string
violations

Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.

Array<object>
object
property
required
string
message
required
string

Example generated

{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"violations": [
{
"property": "example",
"message": "example"
}
]
}

The import is not waiting for review (ImportNotMergeableProblem, naming its state).

Media typeapplication/problem+json

A Problem answered when an import is not waiting for review, so it has no plan and cannot be merged. A 409; nothing was written.

object
type

Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.

string
violations

Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.

Array<object>
object
property
required
string
message
required
string
type
string format: uri
Allowed values: https://modeldesk.io/problems/import-not-mergeable
reason

Why an import has no plan and cannot be merged. not-prepared: its file is still being read, or its parse is not on the model’s import line yet. superseded: a newer import into the model committed on top of it. merged: it was merged already. failed: it failed. deleted: it was discarded. creates-model: it creates a model rather than going into one. not-ready and other-commit: it stopped being the import the merge read while the merge ran.

string
Allowed values: not-prepared superseded merged failed deleted creates-model not-ready other-commit
importId
string format: uuid
mergeCommitId

For merged, the merge commit; absent when the import was merged with nothing to merge.

string format: uuid
errorMessage

For failed, what the import failed with; sent only to a caller who may read the import by its own access rules, since the text can name the file’s address.

string

Example

{
"type": "https://modeldesk.io/problems/import-not-mergeable",
"reason": "not-prepared"
}

Error

Media typeapplication/problem+json

An RFC 9457 problem document, always sent as application/problem+json.

object
type

Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.

string
violations

Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.

Array<object>
object
property
required
string
message
required
string

Example generated

{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"violations": [
{
"property": "example",
"message": "example"
}
]
}