Canonical Model

The file extension for canonical models in JoinedWorkz is: 'cmn'.

Canonical Model Elements

A canonical model file can contain one or multiple model elements of the following types:

Simple Type

A simple type can be:

  • defined from scratch
  • or be specialisation of another simple type

Syntax for definition of simple types:
type<stereotype> name (typeParameters*) parameter=parameterValue*

In case the simple type is defined from scratch it needs to has one of the following stereotypes:

  • string
  • integer
  • long
  • decimal
  • date
  • time
  • boolean
  • binary

Some common simple types-types are defined in the common-base module: An image

This moduleopen in new window is published in Maven Central and intended to be used as a starting point.

Enum

Syntax for definition of enums:

enum<stereotype> name { enumItem: itemValue* }

A basic enum does not need to have a stereotype and in this case also no item values:

An image

For enums with stereotypes their items need to have assigned values: An image

Complex Type

The basic syntax for definition of a complex type:

type<stereotype> name extends baseType property=propertyValue* { field* method*}

Definition of a simple complex type: An image

Definition of a complex type with an unique id, at least one salutation, not more then 3 middle names and a mandatory lastName: An image

Complex types with behaviour can also define methods: An image

Field

The basic syntax for definition a field:

field name: type(typeArgument) parameter=parameterValue

An image

This construct allows to define fields which occurs in many complex types (but can there not be inherited) can so be defined only once (DRY).

FieldSet

In case multiple fields needs to be reused without inheritance field-sets can be used:

An image

Service

The basic syntax for definition of a service:

service<stereotype> name property=propertyValue* { method* }

This defines a service with 2 methods:

An image

Method Type

The basic syntax for definition of a method-type:

methodtype name verb property=propertyValue*

This example defines several method types which can be used in a REST Api:

An image

Resource

The basic syntax for definition of a resource:

resource /resourceName: by resourceIdentifyingAtribute { methods* subresources* }

This is an example for a simple CRUD-resource: An image

Last Updated:
Contributors: Karl Hoenninger