Preview a dataset merge
const url = 'https://api.modeldesk.io/datasets/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/branches/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/merge-preview?source=2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.modeldesk.io/datasets/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/branches/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/merge-preview?source=2489E9AD-2EE2-8E00-8EC9-32D5F69181C0' \ --header 'Authorization: Bearer <token>'What merging the source branch into this one would come to, computed as the merge computes it with nothing written: conflicts lists every row the merge would refuse, described as a refused merge describes them, and is empty when the merge would land; mergeBaseId, targetCommitId and sourceCommitId are the three commits it was computed from, which a merge sent with resolutions is held to. resolvedNames, closureChanges and blockers are always empty for a dataset. A read, open to every reader of the dataset, and held to no head.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The branch that would be merged into.
Query Parameters
Section titled “Query Parameters”The branch that would be merged from, another branch of the same dataset.
Responses
Section titled “Responses”What the merge would come to; nothing was written
What a merge would come to, computed as the merge computes it and never written: every element it would refuse, described as MergeConflictProblem describes them, or none, the three commits it was computed from, what it would do to the dependencies of the branch it lands on, and every rule the merged model as a whole would break. Every member is always written, so a client reads one shape whether or not there are conflicts.
object
Every element the merge would refuse, in element-id order; empty when the merge would land as it stands.
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
What the branch merged into holds for the element.
object
Whether the branch holds the element at all.
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.
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.
What the branch merged from holds for the element.
object
Whether the branch holds the element at all.
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.
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.
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.
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
The attribute or relation key, as the element stores it.
Whether the key is one of the element’s attributes or one of its relations.
The value at the merge base, absent where the base did not hold the element or the key. Shaped as target is.
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.
The value on the branch merged from, shaped as target is.
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
How many taking the target’s pin changes, which is none, as they already follow it.
How many taking the source’s pin changes.
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.
The common ancestor the two branches were compared against.
The head of the branch that would be merged into, as the preview read it. A merge with resolutions sends it as expectedHeadId.
The head of the branch that would be merged from, as the preview read it. A merge with resolutions sends it as expectedSourceHeadId.
Display name by element id for every conflicting element, every owner its sides name and every element a relation value of the conflicts names, read as MergeConflictProblem reads them; empty when there are no conflicts.
object
Every dependency the merge would add to, remove from or repin on the branch it lands on, by name, then the metamodel pin and each extension pin it would move, one entry each; empty when the dependencies would stay as that branch holds them. Of a merge with conflicts, what it would change with every conflict resolved to the branch it lands on.
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
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.
The name of the model depended on, of the document an external dependency reads, or of the metamodel or extension whose pin moves.
The pin the branch merged into holds. Present on a repin, absent on an addition, and optional on a removal.
The pin the merge lands. Present on an addition and a repin, absent on a removal.
The message of every rule the merged model as a whole would break, such as two namespaces under one prefix; empty when it would break none, and empty for a caller who may not merge into the branch, for whom the rules are not asked. No choice of side resolves one: the merge is refused with that rule’s own problem rather than with MergeConflictProblem, and the remedy is a change on either branch before merging.
Example
{ "conflicts": [ { "fields": [ { "kind": "attribute" } ], "reason": "both-changed" } ], "closureChanges": [ { "kind": "added" } ]}source is missing or not a uuid, or is this same branch, answered with the plain problem.
An RFC 9457 problem document, always sent as application/problem+json.
object
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.
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.
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.
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}The dataset does not exist or is not the caller’s to read, answered with the plain problem, or branchId or source names no branch of it, answered as RefNotFoundProblem.
A Problem answered when a ref the request reads at is not there for the caller, on a resource they may read: a ref id that names nothing, a ref of another resource, and another user’s draft, which reads exactly as a ref that does not exist. The draft routes answer it too when the caller holds no draft.
A 404, as a missing resource is, and told apart from one by its type. A resource the caller cannot read keeps the plain answer it always had, whatever ref was named, so this one never says anything about a resource the caller could not see. To a client it means that the ref it was reading, typically a draft committed or discarded in another session, is gone while the resource stays: it goes back to the branch. The problem names no ref, so the answer for an id that names nothing and for another user’s draft is the same, byte for byte.
object
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.
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.
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.
object
Stable constant a client branches on, which is what tells this 404 from a resource that is missing or not the caller’s to read.
An RFC 9457 problem document, always sent as application/problem+json.
object
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.
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.
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.
object
Example
{ "type": "https://modeldesk.io/problems/ref-not-found"}The source holds nothing this branch does not already have, or the two heads have several closest common ancestors, each answered as the merge answers it.
A Problem answered when the source branch holds no commit the target does not already have: its head is the merge base of the two. Nothing was written.
object
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.
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.
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.
object
Stable constant a client branches on, which is what tells this 409 from the others a merge answers with.
A Problem answered when the two heads have several closest common ancestors, as they do after a criss-cross merge: each branch was merged into the other from a head that did not yet hold the other merge. There is then no single base to compare or merge over, and a merge over any one of them can undo, without a conflict, a deletion the other side made since. Nothing was written. A merge of the same two branches, in either direction, answers the same; one history has to be made to contain the other first, by creating one branch again from the other’s head.
object
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.
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.
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.
object
Stable constant a client branches on, which is what tells this 409 from the others the merge and compare routes answer with.
The common ancestors no other common ancestor descends from, in id order: the two pre-merge heads of a criss-cross.
Example
{ "type": "https://modeldesk.io/problems/nothing-to-merge"}