Skip to content

Preview disconnecting an element from its dependency

POST
/models/{modelId}/elements/{elementId}/disconnect-preview
curl --request POST \
--url https://api.modeldesk.io/models/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/elements/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/disconnect-preview \
--header 'Authorization: Bearer <token>'

What a DEPENDENCY_DISCONNECT of a connected element would do, worked out as staging it would, with nothing written: the members the element holds by reference, which would become owned copies of the version depended on, and every reference the copies, or elements of the model referring to a member, would leave out, each named with its reason. Read at the model’s main branch head, or at the head of ref when given. A staged disconnection reports only how many references it left out, in the Disconnect-Dropped-References header; this is where they are named.

modelId
required
string format: uuid
elementId
required
string format: uuid

The connected element, one of a type whose metamodel declares representsModel.

ref
string format: uuid

The ref to read at, a model_branch document id, read as GET /models/{modelId}?ref= reads it: a draft is its owner’s alone. When omitted, the model’s main branch is read.

OK

Media typeapplication/json

What disconnecting an element whose type represents a model from its dependency would do. Nothing is written.

object
elementId
required

The connected element.

string format: uuid
dependencyId
required

The dependency the element is connected to.

string format: uuid
members
required

The members that would become owned copies, in the order the element holds them.

Array<object>

An element as a preview or a refusal shows it.

object
id
required
string format: uuid
name
required

The name it is listed under, its type when nothing names it.

string
type
required
string
droppedReferences
required

The references that would be left out, in the order they were met.

Array<object>

A reference that writing members of a connected element as owned copies would leave out, or left out: by a disconnection or by a version change keeping copies.

object
elementId
required

The element that loses the reference: the member or owned child a copy would be made of, by its id in the version depended on, or an element of the model whose term reference points at a member.

string format: uuid
elementName
required
string
relation
required

The key the reference is stored under.

string
relationLabel

The name the metamodel shows for the relation; absent when it declares none.

string
targetId
required
string format: uuid
reason
required
string
Allowed values: TARGET_NOT_REACHABLE OWNED_CHILD_MISSING TERM_REFERENCE_NOT_A_CANDIDATE

Example

{
"droppedReferences": [
{
"reason": "TARGET_NOT_REACHABLE"
}
]
}

The element is not connected, answered as ChangeValidationProblem with one element-not-connected error naming it, as a staged DEPENDENCY_DISCONNECT is refused.

Media typeapplication/problem+json

A Problem that additionally carries errors when a staged change was refused, with nothing written. Its own type is what tells it from the plain 400 of a malformed body. Separate from Problem.violations, which stays what it is: request-body validation, one entry per rejected field of the request itself.

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 a refused change from the plain 400 of a malformed body.

string format: uri
Allowed values: https://modeldesk.io/problems/change-validation-failed
errors
required

Every reason the change was refused, not only the first, so a whole change can be corrected in one round trip. Never empty: a refusal carries at least one reason. A later entry may still be a consequence of an earlier failing action, which the messages say rather than hide. An entry’s actionIndex counts into the change’s own actions.

Array<object>
>= 1 items

One reason a change was not applied, in the form an agent can correct itself from: which action was at fault, what kind of fault it was, and which element and property it was about. The same shape wherever a refusal is reported, so one piece of client code renders all of them.

code and message answer different readers. The code is a stable constant a client branches on without parsing prose; the message is the human sentence and may be reworded at any time. Every member a throw site did not know is left off the wire rather than sent as null, so a reader never has to tell “not applicable” from “unknown”.

object
actionIndex

Where the failing action sits in the change’s own action list, counted from zero. Absent, together with actionType, when the fault belongs to the change as a whole rather than to one of its actions.

integer
actionType

The type of the failing action, exactly as the caller sent it, which for a not-stageable refusal is a type no variant answers to. Absent together with actionIndex.

string
code
required

A stable kebab-case constant a client branches on rather than parsing the message.

A refusal of the change as a whole carries one of not-stageable, updater-rejected, write-rejected, chain-too-long, change-too-large or closure-action-must-stand-alone. That list is closed, except where the errors member carrying this error names one more of its own. A refusal about one element or one of its properties carries an element-level code from the same namespace instead, such as element-not-found, owner-not-found, already-exists, unknown-property, invalid-target, multiplicity-violated or invalid-value, and a refused dependency action one of dependency-target-not-found, dependency-exists, dependency-in-use, dependency-connected, members-missing-in-version, dependency-not-direct, dependency-version-differs, dependency-snapshot-missing, dependency-metamodel-not-allowed or dependency-not-found, and a relation a change writes into content of a dependency the model no longer holds, which a rebase meets after the branch removed that dependency, dependency-removed, naming the referring element and the relation. A DEPENDENCY_CONNECT or DEPENDENCY_DISCONNECT may carry copy-not-replaceable, element-connected, element-not-connected or connection-changed, and a write that would set, change or clear an element’s connection other than through those two connection-not-writable. That second set is stable in the sense that a code is never reused for something else, but it is open: new ones are added as refusals learn to name themselves, so a client treats one it does not recognise as a refusal it cannot special-case rather than as a malformed response.

string
message
required

The sentence a human reads. Reworded freely, never parsed.

string
elementId

The element the failure is about, where the refusal named one.

string format: uuid
elementName

The name elementId is listed under, where the refusal read it: the connected element a dependency-connected error names, the member a members-missing-in-version error names.

string
property

The attribute or relation the failure is about, where the refusal named one.

string
missingMember

On a members-missing-in-version error: a member a connected element holds by reference that the version its dependency moves to lacks, the element that holds it, and what uses it.

object
memberId
required

The member, an element of the version the dependency leaves.

string format: uuid
memberName
required

The name it is listed under, its type when nothing names it.

string
memberType
required

Its type, as stored.

string
holderId
required

The element that holds the member, one whose type represents a model and that is connected to the dependency.

string format: uuid
holderName
required

The name the element that holds the member is listed under, its type when nothing names it.

string
missingChild

For a member the new version still holds: the owned child of it that the version lacks and the model uses, which makes the member count as missing. Absent for a member the version lacks itself.

object
id
required
string format: uuid
name
required

The name it is listed under, its type when nothing names it.

string
type
required
string
uses
required

The model’s elements referring to the member or one of its owned children, through an authored relation or a term reference, each once per relation, in element id order. The member relation of the element that holds it holds the member rather than using it and is not listed.

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

The key the reference is stored under.

string
relationLabel

The name the metamodel shows for the relation; absent when it declares none.

string
errorCounts

Present only when errors was cut short at its bound: every reason found, counted by code, so a client can say how many there are without parsing detail. A refused DEPENDENCY_UPDATE with many missing members answers its first ones in errors and their total under members-missing-in-version; POST /models/{modelId}/dependencies/{dependencyId}/version-change-preview lists them all.

object
key
additional properties
integer

Example

{
"type": "https://modeldesk.io/problems/change-validation-failed"
}

The caller is an agent acting for a person and the model’s organization 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 model, or one the caller may not read; or the model at that ref holds no such element, answered with the plain problem. Or ref names a ref that is not there for the caller, answered as RefNotFoundProblem.

Media typeapplication/problem+json
Any of:

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
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 404 from a resource that is missing or not the caller’s to read.

string format: uri
Allowed values: https://modeldesk.io/problems/ref-not-found

Example

{
"type": "https://modeldesk.io/problems/ref-not-found"
}

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"
}
]
}