Skip to main content

GraphQL Mapping

This page describes how CK language 2 elements appear in a tenant's GraphQL schema (asset repository): attribute access, CK interfaces as GraphQL interfaces, and the CK meta API.

Element Names​

GraphQL names of CK elements are the model name and the element name without separators. An element version above 1 is appended without the dash; version 1 has no suffix:

CK elementGraphQL name
Acme.Assets/Named-1AcmeAssetsNamed
Acme.Assets/Named-2AcmeAssetsNamed2

The rule applies to all element kinds, so successive interface versions coexist in one schema. Interfaces derived from abstract CK types keep their existing <Type>Interface names.

Name collisions

The compiler only rejects an interface with exactly the name of a type of the same model (message 93). Other collisions of generated GraphQL names are not detected yet and make the tenant's GraphQL schema fail to build — for example an element literally named Named2 next to Named-2, or an interface whose name equals a generated name such as <Type>Interface, <Type>Input or <Type>Update. Avoid such names.

Attribute access​

The access of an attribute assignment shapes the generated schema and the generic CRUD path:

accessOutput fieldInput / …InputUpdate fieldFilter / sortGeneric create / update
ReadWriteyesyesyesallowed
ReadOnlyyesyesyesallowed — not enforced in this phase
MethodOnlyyesnoyesrejected (ATTRIBUTE_NOT_WRITABLE)
Hiddennonorejected (ATTRIBUTE_NOT_QUERYABLE)rejected (ATTRIBUTE_NOT_WRITABLE)

ReadOnly is parsed, persisted and reported by the CK meta API (access), but the generic input types and mutations treat it like ReadWrite for now.

The complete list of paths Hidden covers — and the ones it does not cover yet — is in Access modifiers.

Errors​

Access errors (ATTRIBUTE_NOT_WRITABLE, ATTRIBUTE_NOT_QUERYABLE) carry extensions.code, the attribute path and the operation. They never contain a value, in any environment; values inside entity-selector paths are redacted ([apiKeyHash=…]). Exception details (exception text, inner exceptions, stack traces in extensions.details) are returned only in the Development environment or with the opt-in setting GraphQl:ExposeExceptionDetails (OCTO_GraphQl__ExposeExceptionDetails); deployed services run as Production.

CK Interfaces as GraphQL Interfaces​

Each CK interface of the tenant becomes a GraphQL interface type (named as above):

  • Fields: the system fields of every runtime entity (rtId, ckTypeId, ...) plus one field per attribute member — its own and those of every interface it extends. Optional members are nullable.
  • Implementing types: every entity type implementing the CK interface — directly, through a base type or through an extended interface — implements the GraphQL interface. If a type does not assign an optional member, it still gets the field; the field always resolves to null. If a type's fields cannot be aligned with the interface, the type is not linked to the GraphQL interface and the asset repository logs a warning.
  • extends maps to GraphQL interface inheritance: the GraphQL interface implements all its (transitive) parent interfaces, and implementing object types list the full closure.
  • Association members become interface fields only when every implementing type exposes the outbound association field of that role with the same shape (name, connection type, arguments). Otherwise the member is left out of the GraphQL interface and the asset repository logs a warning. Inbound association members are not exposed.
  • Associations narrowed to an interface (targetCkInterfaceId): the navigation field's union only contains the concrete target types that implement the interface.

Select interface fields with a fragment:

query {
runtime {
acmeAssetsGateway(first: 10) {
items {
... on AcmeAssetsIdentified {
name
description
serialNumber
}
}
}
}
}

To read the entities of all implementing types in one query, use runtime.byInterface.

Querying by Interface​

runtime.byInterface returns the entities of every type that implements a CK interface — directly, through a base type or through an extended interface — in one global order, with filter, sort, paging and an optional count. A generic screen or tool needs no per-type queries.

query {
runtime {
byInterface(
ckInterfaceId: "Acme.Assets/Named-1"
sortOrder: [{ attributePath: "name", sortOrder: ASCENDING }]
fieldFilter: [{ attributePath: "name", operator: LIKE, comparisonValue: "Pump" }]
skip: 0
take: 50
) {
totalCount
items {
__typename
... on AcmeAssetsNamed { name }
... on AcmeAssetsPump { flowRate }
}
}
}
}
ArgumentMeaning
ckInterfaceId (required)The runtime id of the CK interface, e.g. Acme.Assets/Named-1.
take (required)Number of entities to return. There is no default, so a page size is always a conscious choice.
skipEntities to skip in the global order. Default 0.
fieldFilter, sortOrderSame shape as in the per-type queries, but the first segment of an attribute path must be a member of the interface (own or extended) or a system field (rtId, ckTypeId, rtCreationDateTime, rtChangedDateTime, rtVersion, rtWellKnownName, rtCreatedBy). Without a sort order the entities come in ascending rtId order.
optionsincludeArchivedEntities, as in the per-type queries.
searchFilter, aggregations, geoNearFilterAccepted by the schema but refused (see Limits of v1).

Result. items is a list of the union RtEntityByInterface, whose members are all concrete types that implement at least one CK interface. The union is used so that no existing type of the schema changes. Select the interface members with a fragment on the CK interface (... on AcmeAssetsNamed) and the members that belong to one type with a fragment on that type. __typename is the exact type of the entity: an entity of a type derived from Pump reports the derived type. totalCount is counted only when it is selected; it ignores skip and take. There is no pageInfo: a page shorter than take is the last one.

An interface without implementers (or none the caller may see) returns an empty items list and totalCount 0. The field exists in a tenant's schema as soon as one concrete type implements a CK interface; a tenant without any implemented interface has no byInterface field and its schema is unchanged.

Permissions behave exactly like the per-type queries: the caller's data permissions are evaluated per type. A type the caller may not read never appears and its rows are not counted in totalCount. Secret members cannot be used in a filter or sort through the interface either (SecretAttributeNotQueryable; the check runs against every implementing type), and an attribute with access: Hidden cannot be an interface member at all (compiler rule).

Limits of v1​

  • No text search (searchFilter), no aggregations (aggregations), no navigation paths (->, ::) and no geospatial filter (geoNearFilter). They are refused with an error, never silently ignored.
  • skip + take must not exceed 1000.
  • The entities of the interface must live in at most 64 collection roots (a stock tenant has about 38 roots in total).
  • Each type of an interface keeps its own collection; the query asks every collection and merges the answers.

Errors​

A refused request is one GraphQL error without data. The error code is INTERFACE_QUERY_REFUSED; the platform passes the engine's structured error through unchanged. Clients read the extensions, never the message text:

{
"data": { "runtime": { "byInterface": null } },
"errors": [
{
"message": "skip (900) + take (200) is above the maximum of 1000 of an interface query.",
"extensions": {
"code": "INTERFACE_QUERY_REFUSED",
"messageNumber": 7019,
"reason": "PageTooLarge",
"parameters": { "reason": "PageTooLarge", "skip": "900", "take": "200", "maxSkipPlusTake": "1000" }
}
}
]
}

messageNumber is always 7019; the case is the reason token. parameters holds the machine-readable values (all strings).

reasonCauseParameters
UnknownInterfaceThe interface does not exist in the tenant.ckInterfaceId
TextSearchNotSupportedsearchFilter was given.ckInterfaceId
AggregationNotSupportedaggregations was given.ckInterfaceId
NavigationNotSupportedA filter or sort path crosses a navigation, or geoNearFilter was given.ckInterfaceId, attributePath (empty for a geospatial filter)
TooManyCollectionRootsThe interface is implemented in more than 64 collection roots.ckInterfaceId, rootCount, maxRoots
PageTooLargeskip + take is above 1000.skip, take, maxSkipPlusTake
UnknownMemberA filter or sort path does not start with a member of the interface.ckInterfaceId, attributePath, usage (filter or sort)

A malformed argument (ckInterfaceId that is no runtime CK id, negative skip or take) is the error INVALID_ARGUMENT with extensions.argument.

Cost and budget​

The query asks every collection that holds an implementer for its first skip + take + 1 rows in the requested order and merges them. The cost therefore depends on the sort field and on the page depth:

  • Index the sort field. The query creates and changes no index. A type that implements an interface declares the index of the member that clients sort by in its own type (indexes:); without it every collection reads all of its matching rows for the sort, and the cost is O(matching rows) like a type query. No latency is promised for a sort without an index. There is no default index on name.
  • With an index on the sort field the budget is: implementers in one collection at most 1.25 x of a type query returning the same rows; implementers in several collections a first page of p95 at most 100 ms for up to 30 collections and 1 000 000 entities.
  • Deep pages are expensive. Every collection returns its top skip + take + 1 rows before the merge, so a page costs about (skip + take) x the number of collections that hold implementers. This is why skip + take is capped at 1000. Filter, and keep pages small, instead of paging deep.
  • totalCount is one count per collection and costs O(matching rows); select it only when you need it.
  • Inside a transaction (for example a call from a pipeline node) the collections are queried one after the other, outside a transaction in parallel. The result is the same.

CK Meta API​

The constructionKit query describes the CK language 2 meta model. The new enumeration-like values (visibility, derivable, access, kind, multiplicity) are strings with PascalCase names (Public, Model, Hidden, Instance, ...); value types (valueType, attributeValueType) are the existing GraphQL enum (STRING, RECORD, ...). Elements of CK language 1 models report the v1 defaults.

TypeNew fields
CkTypevisibility, derivable, declaredInterfaces, interfaces (declared, inherited and extended), methods (own and inherited)
CkTypeAttributeaccess
CkRecordvisibility, derivable
CkEnum, CkAttribute, CkAssociationRolevisibility
CkModelckLanguage (1 when not declared), minEngineVersion, dependencyRanges { range floor } (null for exact-pinned models)
CkInterface (new)ckInterfaceId, rtCkInterfaceId, description, visibility, deprecated, extends, allExtends, attributes (ckAttributeId, attributeName, attributeValueType, isOptional, including extended members), associations (ckAssociationRoleId, targetCkTypeId, targetCkInterfaceId, multiplicity, isOptional, declaringCkInterfaceId), methods, implementingTypes
CkMethod (new)methodId, qualifiedMethodId, declaringCkTypeId / declaringCkInterfaceId, kind, description, visibility, parameters (name, valueType, valueCkRecordId, valueCkEnumId, isOptional, sensitive, description), result (valueType, valueCkRecordId, valueCkEnumId, sensitive), errors (CkMethodErrorDefinition), authorization (roles, allowSelf, scopes), execution (timeoutSeconds, idempotent, handler, mode), replacesGenericCreate
ConstructionKitQueryinterfaces(ckModelIds, rtCkId, rtCkIds)

Internal elements are listed like public ones — internal means "not referencable from other models", not secret.

Example:

query {
constructionKit {
types(rtCkId: "Acme.Assets/Device") {
items {
visibility
derivable
interfaces { rtCkInterfaceId }
methods {
methodId
kind
parameters { name valueType isOptional sensitive }
result { valueType sensitive }
authorization { roles allowSelf }
execution { timeoutSeconds handler mode }
}
attributes(first: 50) { items { attributeName access } }
}
}
interfaces(ckModelIds: ["Acme.Assets"]) {
items {
rtCkInterfaceId
extends { semanticVersionedFullName }
attributes { attributeName isOptional }
implementingTypes { semanticVersionedFullName }
}
}
models(first: 50) {
items {
id { name }
ckLanguage
dependencyRanges { range floor }
}
}
}
}

result.sensitive is true when the method declares its result as sensitive. A sensitive result is never logged, audited or traced, and it cannot be used in filters; tools and generated clients should hide it in their own logs and UIs as well. The field is false when the marker is not declared (including models without the key) and null for a method without a result (result itself is null). Queries that do not select the field are unaffected.

execution reports the effective values: timeoutSeconds (15 when not declared), idempotent, handler (service when not declared, or pipeline, see Handler kind) and mode (sync when not declared, or async, see Execution mode). A method with mode: async answers a call with an operation handle once its handler has accepted the work; its timeoutSeconds bounds that accept step. Models and tenant documents without the key report sync. Queries that do not select handler or mode are unaffected.

More CK meta queries: Construction Kit retrieval.

Methods​

Every method of a method-bearing type is a typed mutation in the tenant schema. The method definitions themselves are also readable through the CK meta API (CkMethod).

Typed method mutations​

A concrete CK type with methods gets one mutation field per method next to create and update, under the per-type mutation field:

mutation {
runtime {
sampleDevices {
calibrate(rtId: "65f0c0ffee65f0c0ffee65f0", input: { target: 21.5, mode: MAINTENANCE }) {
invocationId
result { name value }
}
probe { invocationId result }
}
}
}
PartRule
Field nameThe method name without the version dash, in camelCase: Calibrate-1 becomes calibrate; a version above 1 is appended (Calibrate-2 becomes calibrate2), so versions coexist.
rtIdInstance methods take the runtime id of the target entity as rtId: OctoObjectId!. Static methods have no rtId.
inputBuilt from the declared parameters, one field per parameter. A required parameter is non-null, an optional one nullable; enum and record parameters use the generated enum and record input types, list parameters are lists. The argument itself is required when at least one parameter is required, and absent for a method without parameters.
idempotencyKeyOptional String on every method field, instance and static. A call with a key runs at most once per tenant, method, caller and key (up to 128 characters); a repeat with the same key and the same parameters returns the first result instead of running the method again. See Idempotency key. Without the argument nothing changes.
Result type{Declaring type}{Method}MethodResult with invocationId (for correlation with the handler log) and, when the method declares a result, result typed from the declared value type (scalar, enum, record, list). result is the value itself: a String result is the string ("result": "6ae7c66ccc5a608ccf779df9"), an Int result the number, a record result the record object. It has no error member. An asynchronous method (execution.mode: async) has operation (the handle) instead of result, see Asynchronous methods and operations.
Inherited methodsA method inherited from a base type or implemented from an interface appears once on every derived concrete type. The input and result types are shared with the declaring type.

Types without methods are unchanged. If the generated field name equals another field of the type (for example a method named Create, which is reserved anyway, or two methods that map to the same name), the schema of the tenant is not built and the error names the type and the method.

A failed call is one GraphQL error, the data of the field is null:

{
"data": { "runtime": { "sampleDevices": { "calibrate": null } } },
"errors": [
{
"message": "The CK method call failed: CALIBRATION_OUT_OF_RANGE",
"extensions": {
"code": "CALIBRATION_OUT_OF_RANGE",
"parameters": { "methodId": "Sample/Device.Calibrate-1" }
}
}
]
}

extensions.code is a platform code (METHOD_FORBIDDEN, METHOD_TARGET_NOT_FOUND, METHOD_VALIDATION_FAILED, METHOD_HANDLER_NOT_AVAILABLE, METHOD_TIMEOUT, METHOD_HANDLER_FAILED, METHOD_PARAMETERS_TOO_LARGE, ...) or an error code that the method declares itself (kept as the handler sent it). The client only ever sees a code the platform issued: any other code a responder writes, including an unknown METHOD_ code, is answered as METHOD_HANDLER_FAILED with the correlationId; the original code is only logged. extensions.parameters holds the language-neutral parameters of the code; extensions.details appears only when the handler returned per-item details (code and parameters each). The message is fixed text, never parameter or result data.

A call runs through the gateway gate. The answer is the handler's typed result (invocationId and, for a method with a declared result, result), or ONE error with data.<method> = null; success, a declared handler error, METHOD_HANDLER_NOT_AVAILABLE, METHOD_TIMEOUT and METHOD_HANDLER_FAILED are all mapped this way.

For the build time of the schema see the asset repository's GraphQL schema for tenant ... built in ... ms log line: it names the number of CK methods.

Idempotency key​

mutation {
runtime {
sampleAccounts {
resetPassword(rtId: "65f0c0ffee65f0c0ffee65f0", input: { newPassword: "..." }, idempotencyKey: "reset-2026-10-30-a1") {
invocationId
}
}
}
}

The key belongs to the caller, not to the method call: the scope is tenant, method, caller and key, so two callers can use the same key independently. Send the same key again to repeat a call safely (after a timeout or a double click). A key is remembered for its lifetime, 24 hours by default (Methods:Idempotency:Ttl); after that it counts as new.

SituationAnswer
First call with the keyThe method runs.
Same key, same parameters, first call finishedThe first result is returned (with a new invocationId); the method does not run again.
Same key, first call still runningMETHOD_REQUEST_IN_PROGRESS. Send the same key again later.
Same key, other parametersMETHOD_VALIDATION_FAILED with field = idempotencyKey and reason = parameters-changed. Use a new key for a new request.
Key longer than 128 charactersMETHOD_VALIDATION_FAILED with field = idempotencyKey and reason = key-too-long.
Method with a sensitive resultMETHOD_VALIDATION_FAILED with reason = result-sensitive: such a method does not accept a key.
Call without an authenticated caller (a token with neither sub nor client_id)METHOD_VALIDATION_FAILED with reason = caller-unknown: a key has no scope without a caller. A client-credentials token is a known caller: its key is scoped by its client id.
First call ended with an unknown outcome or failed unexpectedlyThe key is used up: METHOD_OUTCOME_UNKNOWN or the stored failure. Check the state of the target; use a new key for a new attempt.
The key service is not configured (fingerprint-key-missing: only for a method with sensitive parameters and no fingerprint key; fingerprint-unavailable) or the store is unavailableThe method does not run. METHOD_VALIDATION_FAILED for a missing configuration, METHOD_HANDLER_NOT_AVAILABLE with reason = idempotency-store-unavailable for an unavailable store; retry later.

All rules, the outcomes that burn a key and the operator settings: Method Consistency Model, R8.

A method that declares execution.idempotent: true ignores the key: it is accepted, nothing is stored and the method runs on every call.

Errors never contain the key or a parameter value. A key does not widen any permission: authorization and the data-permission check run before the key is looked at.

Mixed rollout: a service version that does not know the argument rejects the query at schema validation, it never ignores the key silently.

Asynchronous methods and operations​

A method declared execution.mode: async (Execution mode) does its work after the call has returned. Its mutation answers with an operation handle as soon as the handler has accepted the work and the platform has recorded the operation; state, progress and the result (or the error) are read later through runtime.operations.

mutation {
runtime {
sampleTenants {
dump(idempotencyKey: "backup-2026-11-09") {
invocationId
operation { operationId acceptedAtUtc retryAfterSeconds expiresAtUtc }
}
}
}
}

The result type of an asynchronous method has invocationId and operation: CkMethodOperationHandle!, and no result field. The handle has the four fields of the wire contract: operationId (opaque, unique in the tenant), acceptedAtUtc, retryAfterSeconds (wait that long before the first status check) and expiresAtUtc (null while the operation runs). Synchronous methods keep exactly the shape described above. A failed accept (refused, invalid parameters, handler not available, the operation could not be recorded) is one GraphQL error like any other method call, and no operation exists then.

Read one operation with its id:

query {
runtime {
operations(operationId: "3f2a9c5d0e1b4a7c8d9e0f1a2b3c4d5e") {
items {
operationId methodId state
progress { percent stageCode parameters { name value } }
result
error { code parameters { name value } }
acceptedAtUtc startedAtUtc completedAtUtc expiresAtUtc
}
}
}
}
FieldMeaning
stateACCEPTED (recorded, work not started), RUNNING, SUCCEEDED, FAILED. The last two are final: the operation never changes again.
progressThe last progress report of the handler: percent (0–100 or null), a language-neutral stageCode (for example COPYING_COLLECTIONS) and its parameters. There is no message text; the client renders the stage in its own language.
resultThe result of a SUCCEEDED operation of a method with a result, as a JSON value (string, number, object, list). Always null when the method marks its result sensitive: such a result is never stored.
errorThe error of a FAILED operation: the same code and parameters that a synchronous call returns in extensions (a platform code or a code the method declares). METHOD_OUTCOME_UNKNOWN with reason = handler-lost means the handler stopped before it finished; the platform never starts the operation again (OD-5). Check the state of the target before you start a new operation, with a new idempotency key.
expiresAtUtcCompletion plus the retention (7 days by default, Methods:Operations:Retention, 1 hour to 30 days). After that the operation is forgotten.

List the operations of the caller, newest first; the filters also narrow a read by id:

query {
runtime {
operations(methodId: "System.Bot/TenantRepository.Dump-1", state: RUNNING, since: "2026-11-01T00:00:00Z", skip: 0, take: 50) {
totalCount
items { operationId state progress { percent } acceptedAtUtc }
}
}
}
ArgumentRule
operationIdReturns that operation, or OPERATION_NOT_FOUND.
methodIdQualified, version-less method id (Model/Type.Method-1), exact match.
stateACCEPTED, RUNNING, SUCCEEDED or FAILED.
sinceOperations accepted at or after this time (UTC).
allOwnerstrue lists the operations of every caller of the tenant; tenant administrators only (otherwise OPERATION_QUERY_REFUSED with reason = administrators-only). Default false: the caller's own operations, also for an administrator.
skip, takePaging; take is 1 to 200 (default 50), skip 0 or more (otherwise OPERATION_QUERY_REFUSED with reason = invalid-paging and argument).

Who may read an operation. Within the tenant of the route only: the caller who started it (the same sub; for a client-credentials token without sub, the same client_id) and tenant administrators (the roles of Methods:Authorization:AdministratorRoles, default AdminPanelManagement, the same setting that admits administrators to methods). Everyone else, an unknown id, an expired id and an id of another tenant get the same answer, so the error tells nothing about whether the operation exists:

{
"data": { "runtime": { "operations": null } },
"errors": [
{
"message": "The operation was not found. It may never have existed, may have expired, or may not be readable for the caller.",
"extensions": { "code": "OPERATION_NOT_FOUND", "parameters": {} }
}
]
}

Polling. Wait retryAfterSeconds of the handle before the first read, then poll at a moderate interval until the state is SUCCEEDED or FAILED; stop on OPERATION_NOT_FOUND. If the answer of the mutation was lost, find the operation again in your own list (operations(methodId: ..., since: ...)) instead of calling the method again, or call it again with the same idempotency key: a repeated key returns the same operationId, and no second operation is started (OD-5, point 7).

One call per request. An asynchronous method call is still the one method call of its request (One method call per request). runtime.operations is a query and not affected.

There is no cancellation of an operation.

The gateway gate​

Every method call that reaches the asset repository passes one gate, which decides before the target entity is loaded whether the caller may make the call. The order is fixed:

  1. Authenticate. A call without an authenticated principal is refused.
  2. Check the caller's tenant. A token issued for another tenant (or a user token without tenant_id) is answered with METHOD_FORBIDDEN and reason: tenant-not-allowed before anything below; a service token of another tenant passes only when its client is listed in TenantAuthorization:CrossTenantServiceClientIds (see the caller's tenant). When the HTTP tenant gate of the service enforces, such a request is usually refused with HTTP 403 before GraphQL runs; this step is the answer for every call that reaches the gateway, also while the HTTP gate only logs.
  3. Authorize with the same evaluator that the invocation pipeline uses, so there is one set of rules (see where the declaration is enforced): the scope octo_api and the declared scopes, then the declared roles, then allowSelf on the parsed target id. A method without a declaration is for administrators only.
  4. Check the size of the parameters. Parameters above the limit (Methods:MaxParametersBytes, default 1 MiB, measured as UTF-8 bytes of the parameter JSON; exactly the limit passes) are answered with METHOD_PARAMETERS_TOO_LARGE (maxBytes, actualBytes) before anything is read or validated; nothing is dispatched. See limits of a call.
  5. Load the target and check the data permission (instance methods; a static method has no target and only its declaring type is judged). The read runs with the caller's security context in a session of its own, outside the request's database transaction. The data action is Write unless the method declares authorization.dataAccess: Read (Data Permissions).
  6. Validate the parameters against the declaration of the method.
  7. Dispatch the call to the handler.

The scope octo_api is required for every method call, for administrators too, and independent of the setting that makes the scope mandatory for generic mutations. A refusal of step 3 is the error METHOD_FORBIDDEN with the parameters methodId and reason: not-authorized (step 2 answers reason: tenant-not-allowed). Because the target is not read before the check and the answer depends only on the method and the caller, the refusal is identical whether the target exists or not: a caller without the right cannot probe for entities. METHOD_TARGET_NOT_FOUND is only returned to a caller who passed the check, and it is the answer for a target that does not exist and for one that data permissions hide from the caller (same code, message and parameters). A target the caller can read but not change is METHOD_FORBIDDEN with reason: data-permission. The decision behind this order is OD-12. The log line of a refusal names the method, the tenant and the rule, never the target id, the parameters or the token.

Invalid parameters (a required parameter is missing, a member is not declared, a value has the wrong JSON type) are answered with METHOD_VALIDATION_FAILED; the parameters field (the offending members, sorted and comma separated) and reason (missing-required, unknown-member, wrong-type) name members only, never a value, and nothing is dispatched. The check runs after authorization and after the target lookup, so a caller who may not call the method, or who names a missing target, never gets a statement about the parameters.

A failed method call is reported as one GraphQL error with a stable extensions.code and extensions.parameters and a fixed message; the wire carries codes, never message text. A request carries either generic mutations or exactly one method call (decision).

Generic create of a type with a replacing method​

When a type has a static method with replacesGenericCreate: true, declared on the type itself or on a base type, the generic create of that type is refused: the per-type create, the untyped runtimeEntities.create and the create of a runtime query (runtimeQuery(rtId).create, for every row type). The answer is one GraphQL error, the data of the field is null, and nothing is written:

{
"errors": [
{
"message": "The generic create of 'Sample/Device' is replaced by the CK method 'Sample/Device.Provision-1'. Call the method instead.",
"extensions": {
"code": "GENERIC_CREATE_REPLACED_BY_METHOD",
"parameters": { "ckTypeId": "Sample/Device", "methodId": "Sample/Device.Provision-1" }
}
}
]
}

ckTypeId is the type the caller tried to create (a derived concrete type is refused with the method of its base type), methodId the qualified id of the method to call instead. The message contains only these ids, so it is the same for every caller and never contains entity data. The refusal needs no method right; it is evaluated after authentication. update, delete (including those of a runtime query) and all other mutations of the type, and the generic create of every other type, work as before. The CK meta API shows the flag as replacesGenericCreate on the method.

The refusal is not limited to the GraphQL create. The runtime import (ImportRt, insert and upsert, with or without -r) refuses a new entity of such a type as well, with the same reason GENERIC_CREATE_REPLACED_BY_METHOD (message 137); nothing is written, and updates of existing entities still work. Blueprint seed data is refused with message 136, and the pipeline nodes that insert entities refuse as well, see Pipelines that insert entities.

One method call per request​

A mutation request carries either generic mutations or exactly one method call. A request that mixes a method call with a generic mutation, or that contains two or more method calls, is refused as a whole in the validation phase, before any mutation or method runs: nothing is written, no handler is called, no transaction is opened. The reason is that a method runs outside the request transaction and cannot see uncommitted writes of the same request (decision OD-1 and OD-2).

The answer is one GraphQL error without data:

{
"errors": [
{
"message": "A mutation request carries either generic mutations or exactly one CK method call.",
"extensions": {
"code": "ONE_METHOD_CALL_PER_REQUEST",
"parameters": {
"methodIds": "Sample/Device.Provision-1,Sample/Device.Reset-1",
"reason": "MULTIPLE_METHOD_CALLS"
}
}
}
]
}
  • reason is MIXED_WITH_GENERIC_MUTATION (a method call next to a generic mutation) or MULTIPLE_METHOD_CALLS (two or more method calls).
  • methodIds lists the qualified ids of all method fields of the request, sorted and comma separated.
  • The message is fixed and contains neither argument values nor entity data, so two requests that differ only in their argument values get a byte-identical error. The code is a GraphQL-layer code next to FORBIDDEN; it is not a code of the method response envelope (METHOD_*).

What counts:

  • Only the selected operation of the document is judged, and only if it is a mutation. Queries, subscriptions and introspection are never judged; the other operations of a multi-operation document are ignored.
  • Aliases, fragment spreads and inline fragments are resolved. The same method under two aliases, or in a fragment, counts twice.
  • @skip and @include are not evaluated: a method field counts whether or not it would be skipped at runtime.
  • A method field is recognized by the metadata of the generated field, not by its name. Every other field that does work (create, update, delete, the archive and blueprint mutations, ...) is a generic mutation; the navigation fields of the mutation tree (runtime, the per-type mutation field) do not count.
  • Asynchronous methods count as well; they are not exempt (OD-1, decision option A).

Workaround for a caller: send the generic mutations in one request and the method call in its own request, after the first one succeeded.

See Also​