External datasource schema

Prev Next

Reference for <systemKey>-datasource-*.json — business metadata, dimensions, foreign keys, capabilities, CIP execution, sync, and exposure.

Source of truth

  • Schema file: external-datasource.schema.json (the documentation anchor mirrors the Dataplane source; the Builder CLI ships the consumer copy)
  • Schema key: external-datasource-schema
  • Version: 2.9.25 (verify in schema metadata.version)

Validate:

aifabrix validate <datasourceKey>
aifabrix datasource validate <datasourceKey>

Top-level fields (summary)

Field Purpose
key / systemKey Datasource and parent system identifiers
entityType / resourceType Business entity classification — entityType enum: documentStorage, vectorStore, recordStorage, messageService, serviceContract, none; resourceType is a catalog key
fieldMappings Attribute normalization rules (raw/foreign-key values to normalized attributes); keys must match metadataSchema
dimensions Root-level ABAC dimension bindings (not nested under fieldMappings) — see Configure business policies
foreignKeys Cross-system relationships
capabilities Operation keys bound to openapi / execution.cip operations, with optional risk metadata
execution Execution engine configuration — cip (native), python, or datasource-chaining
documentStorage Binary operation binding, processing and ingestion eligibility for document entities
sync enabled, direction, full-set schedule, batch size, and optional incrementalKey / incrementalSchedule — see Configure sync
exposed REST/MCP publication flags
externalSpec Authoritative vendor/API spec reference for this datasource

Important rules

lookup(matchField, matchValue, resultField, fallback) selects a value from an array of objects by a labelled relationship. It requires datasource schema 2.9.15 or later and a runtime that registers lookup; updating the schema alone does not upgrade an older runtime. Matching preserves string, number and boolean types. Multiple matches must agree on the result and its type. The optional fallback applies only to null input or no match; malformed arrays, missing or empty matching results, and conflicting matches fail. Function-based mappings are non-invertible: set an explicit writePath if the field must support writes. This uses the existing mapping DSL and requires no database migration.

  • Root externalSpec is the datasource-grade contract source; system JSON OpenAPI/MCP are hints only.
  • Dimensions and foreignKeys drive ABAC and Enterprise Knowledge relationships.
  • callerIdentityEdge was removed in 2.9.22. Model a caller's own rows through governed record identity, required local dimensions, and foreign-key relationships. A manifest that still declares callerIdentityEdge must drop it before upgrading.
  • Published MCP/REST tools deduplicate to enterprise capability keys at compile time.
  • Custom CIP reads use their declared read shape. Core list and search are list reads and core get is an item read. A custom read returning several records declares shape: list; one returning one record declares shape: get. A custom read with no read shape returns one result and remains callable by its own operation name.
  • Field-mapping expressions may read request values through parameters.<path>. Caller inputs and write data are at the root; record id and path parameters are under parameters.operation.<pathParam>. raw.* reads only the provider response. Request parameters cannot provide externalId or a primary-key attribute.
  • A CIP operation input property whose value is a system key may declare x-aifabrix-refersTo (2.9.25, optional). existingSystem means the value names a system the caller can see; newSystemKey means the value is the key of a system the operation creates, which must not already exist. The keyword is allowed on input.properties.<name> and one level down on a nested object input's properties.<child>. Publish refuses it on a property that is not type string, with any other value, or anywhere else in the input schema. An operation may declare several such inputs. The value comes only from a stated identifier or the model's own argument, never from prose, and a declared input is never stripped as the host routing key. Existing manifests still validate.
  • CIP write shape accepts declared create, update, upsert, and delete. An upsert composes the datasource's standard create and update operations and fails closed when identity or branch permission is unresolved.
  • CIP fetch.responseType accepts json (default) or binary; binary fetch is supported for openapi and http. output.mode: documents requires enabled document storage and emits stored-document references. A keyed-only get needs no list operation. See Build a document storage entity.
  • HTTP response-normalization host allowlists name hosts, not arbitrary URL substrings. An entry such as example.com covers that host and its subdomains; example.com.attacker.invalid and a URL containing example.com only in its path are outside that boundary. The schema descriptions also limit native redirect authorization forwarding to the request's own origin. Confirm runtime support before relying on redirect behavior; a schema refresh alone does not upgrade the runtime.
  • A new sync configuration defaults to enabled monthly UTC. Existing schedule-less configurations remain manual-only; sync.enabled: false blocks synchronization while retaining schedule settings.
  • This page summarizes fields — it is not a second schema. When prose and JSON Schema conflict, the schema file wins.

Related