context-mapping¶
Relationship between two Bounded Contexts, or between a Bounded Context and an External System. See Concepts: Context Mapping.
Schema¶
oneOf:
- properties:
type:
const: customer-supplier
customer:
oneOf:
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
boundedContext:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, boundedContext]
additionalProperties: false
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
externalSystem:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, externalSystem]
additionalProperties: false
supplier:
oneOf:
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
boundedContext:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, boundedContext]
additionalProperties: false
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
externalSystem:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, externalSystem]
additionalProperties: false
terms:
type: array
minItems: 1
items:
type: object
properties:
customer:
type: string
minLength: 1
supplier:
type: string
minLength: 1
required: [customer, supplier]
additionalProperties: false
required: [type, customer, supplier]
- properties:
type:
const: conformist
conformist:
oneOf:
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
boundedContext:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, boundedContext]
additionalProperties: false
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
externalSystem:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, externalSystem]
additionalProperties: false
upstream:
oneOf:
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
boundedContext:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, boundedContext]
additionalProperties: false
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
externalSystem:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, externalSystem]
additionalProperties: false
terms:
type: array
minItems: 1
items:
type: object
properties:
conformist:
type: string
minLength: 1
upstream:
type: string
minLength: 1
required: [conformist, upstream]
additionalProperties: false
required: [type, conformist, upstream]
- properties:
type:
const: anti-corruption-layer
downstream:
oneOf:
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
boundedContext:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, boundedContext]
additionalProperties: false
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
externalSystem:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, externalSystem]
additionalProperties: false
upstream:
oneOf:
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
boundedContext:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, boundedContext]
additionalProperties: false
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
externalSystem:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, externalSystem]
additionalProperties: false
terms:
type: array
minItems: 1
items:
type: object
properties:
downstream:
type: string
minLength: 1
upstream:
type: string
minLength: 1
required: [downstream, upstream]
additionalProperties: false
required: [type, downstream, upstream]
- properties:
type:
const: open-host-service
host:
oneOf:
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
boundedContext:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, boundedContext]
additionalProperties: false
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
externalSystem:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, externalSystem]
additionalProperties: false
consumer:
oneOf:
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
boundedContext:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, boundedContext]
additionalProperties: false
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
externalSystem:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, externalSystem]
additionalProperties: false
terms:
type: array
minItems: 1
items:
type: object
properties:
host:
type: string
minLength: 1
consumer:
type: string
minLength: 1
required: [host, consumer]
additionalProperties: false
required: [type, host, consumer]
- properties:
type:
const: published-language
publisher:
oneOf:
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
boundedContext:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, boundedContext]
additionalProperties: false
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
externalSystem:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, externalSystem]
additionalProperties: false
consumer:
oneOf:
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
boundedContext:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, boundedContext]
additionalProperties: false
- type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
externalSystem:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, externalSystem]
additionalProperties: false
terms:
type: array
minItems: 1
items:
type: object
properties:
publisher:
type: string
minLength: 1
consumer:
type: string
minLength: 1
required: [publisher, consumer]
additionalProperties: false
required: [type, publisher, consumer]
- properties:
type:
const: shared-kernel
participants:
type: array
minItems: 2
maxItems: 2
items:
type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
boundedContext:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, boundedContext]
additionalProperties: false
required: [type, participants]
- properties:
type:
const: partnership
participants:
type: array
minItems: 2
maxItems: 2
items:
type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
boundedContext:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, boundedContext]
additionalProperties: false
required: [type, participants]
- properties:
type:
const: separate-ways
participants:
type: array
minItems: 2
maxItems: 2
items:
type: object
properties:
domain:
type: string
pattern: "^[a-z][a-z0-9-]*$"
boundedContext:
type: string
pattern: "^[a-z][a-z0-9-]*$"
required: [domain, boundedContext]
additionalProperties: false
required: [type, participants]
Anatomy¶
A Context Mapping carries no scope – its endpoints may straddle Domains. The natural identifier of a mapping is its type plus its endpoints; name is a human-readable handle, not a referenced identifier from elsewhere in the model.
The type field selects the mapping pattern from a closed set: customer-supplier, conformist, anti-corruption-layer, open-host-service, published-language, shared-kernel, partnership, or separate-ways. The chosen value determines which sibling fields are required, because each pattern has its own role vocabulary.
The asymmetric patterns name two distinct sides. customer-supplier requires customer and supplier. conformist requires conformist and upstream. anti-corruption-layer requires downstream and upstream. open-host-service requires host and consumer. published-language requires publisher and consumer. Each role accepts either a Bounded Context reference ({ domain, boundedContext }) or an External System reference ({ domain, externalSystem }), so a mapping can describe an internal collaboration or a relationship with the outside world equally well.
On the asymmetric patterns, the optional terms list relates the vocabulary of the two sides: each entry names one term per role, for example { customer: Customer, supplier: Account } on a customer-supplier mapping, meaning that what Sales calls a Customer is what Billing calls an Account. Each value is a canonical term from the ubiquitous language of the Bounded Context on that side, in that context's own language – translations are not addressable here. Term pairs need both endpoints to be Bounded Contexts, since an External System has no ubiquitous language; the resolver reports a pair on a mapping with an External System endpoint, and a term that the endpoint's language does not declare.
The symmetric patterns – shared-kernel, partnership, separate-ways – use a single participants field that takes exactly two Bounded Contexts. External Systems are not allowed here on purpose: sharing a kernel or forming a partnership with a third-party system does not fit the model. If the relationship needs to acknowledge an outside system, use one of the asymmetric patterns instead.
description and metadata carry the usual free-form prose and non-semantic attachments. apiVersion is schema.esdm.io/core/v1, kind is context-mapping, and name is the mapping's handle in the kebab-case name pattern.