Canonical schema pattern

In software engineering, Canonical Schema is a design pattern, applied within the service-orientation design paradigm, which aims to reduce the need for performing data model[1] transformation when services[2] exchange messages that reference the same data model.

This runtime data model transformation adds processing overhead and complicates the design of service compositions.

[5] In order to avoid the need for data model transformation, the Canonical Schema pattern dictates the use of standardized data models for those business documents that are commonly processed by the services in a service inventory.

For example, in case of web services, the business documents are modeled as XML schemas.

On some occasions, either because of the sheer size of the organization or because of the resistance from different segments of the enterprise, the Canonical Schema design pattern may need to be applied within a particular domain inventory, created by the application of the Domain Inventory design pattern.

Diagram A
Diagram A
Service A is using a different data model as compared to Service B for the same business document. When messages are exchanged, runtime data model transformation needs to be performed.
Diagram B
Diagram B
Both services are using the same data model for representing a particular business document. As a result, no data model transformation is required when messages are exchanged.