Skip to content

Resources and Operations ​

This page explains how the C++ SDK expresses resource page-generation semantics through the descriptor v2. The current target model is FunctionContract / ResourceCapability / CapabilitySemantics / PageSpec.

A Resource is neither a database table nor a runtime object. It is only a stable key under which a group of functions are organized around the same business capability domain — e.g. wallet, inventory, orders, player profile. The SDK descriptor only supplies function capability contracts; page categories, dynamic labels, page types, and placement are decided in the Dashboard, not in the SDK.

ID Reference Pattern ​

Functions should not pass large object instances as arguments; they should reference business objects by stable ID:

cpp
invoke("wallet.transfer", {
  {"from_player_id", "player123"},
  {"to_player_id", "player456"},
  {"currency_code", "gold"},
  {"amount", "100.0"}
});

This keeps functions stateless, which enables horizontal scaling, permission auditing, and automated page generation.

Descriptor v2 Essentials ​

FieldDescription
idUnique function id, e.g. wallet.transfer
versionFunction version
summary / descriptionFunction summary and detailed description
input_schema / output_schemaJSON payload input/output contracts (member names; contract keys inputSchema / outputSchema])
resourceBusiness resource or capability-domain key
operationBusiness operation key
capabilityControlled resource semantics, e.g. collection_query, update, action
executionExecution semantics: sync / task (batch fan-out etc. use task)
approval_required / approval_policy_keyApproval switch and approval policy key for high-risk operations (contract keys approvalRequired / approvalPolicyKey)
riskGovernance risk level

Recommendations ​

  • Default page generation derives from input/output contracts and CapabilitySemantics; the SDK may provide a controlled capability hint, and the frontend should not guess from function names.
  • Dynamic categories, resource titles, action titles, and button placement must come from PageSpec, not from SDK descriptors or frontend static locale files.
  • Use ID references, not heavyweight object instances.
  • Keep functions stateless; look up objects through repositories or services.
  • Keep descriptor IDs and operation keys stable.