Schema

The Schema defines a data structure in an application. The schema is used to define the data structure in multiple parts of an application, e.g. API Request Payload, Event Payload and Aggregate State.

A Schema is a set of Properties. Every Property has a Data Type, can be an Object of Properties or an Enum and be optional or an array. All Properties that enter the domain layer have a Value Object attached.

Data Flows define how Schemas interact with each other.

Property

Add

1
Add a property
  • Click the plus icon on the of the schema name right, e.g. on the right next to request.
2
Property name
  • Type a name of choice in the name input.
The name can only contain lower case letters, white spaces and numbers.
This restriction exists in order to be able to translate the property name into code.
3
Property data type
  • Select a property data type.
For more details about the data types object and enum see below.
4
Optional and Array
  • Check the Optional checkbox for an optional property.
  • Check the Array checkbox and the data type is an array of the selected data type.
For more details about the data types object and enum see below.
5
Save
  • Click the checkmark icon to create the new property.
  • Click the cross cancel the property creation.

Schema with properties

Edit

Press next to a property to edit the name, data type and redefine if the property is optional or an array.

Delete

Press next to a property to delete the property. The property will be removed without option to recover it.

If the property is used as Value Source, the Value Source will be deleted too.

Object

The object is a reusable set of properties. The object and its properties can be defined once and used as the type of multiple properties within multiple schemas.

A change of an object changes it globally. That means if the object is changed in one schema, will be changed in all schemas. e.g. adding a property to the object, will add a property everywhere the object is used as the type for a property.

There are two ways to add an object:

  1. Add and edit an object while adding a schema property, see Add in Schema view
  2. Add, edit and delete an object only, see Add in Object overview

Add in Schema view

1
Add property
  • Click the plus icon on the right next to the schema name
  • E.g. on the right next to 'request'.
2
Property name
  • Pick a name for the property.
  • Type a name of choice in the name input.
The name can only contain lower case letters, white spaces and numbers.
This restriction exists in order to be able to translate the property name into code.
3
Property data type object
  • Select 'object' as property data type.
4
Create Object
  • Click the plus next to the object dropdown.
An object is reusable and can be used as a type for multiple properties in multiple schemas.
5
Object name
  • Pick a name for the object.
  • Type a name of choice in the name input.
The name can only contain lower case letters, white spaces and numbers.
This restriction exists in order to be able to translate the object name into code.
6
Save the object
  • Click the checkmark icon to create the new object.
  • Click the cross cancel the object creation.
7
Select Object
  • Ensure the new created object is selected in the object dropdown.
8
Save the property
  • Click the checkmark icon to create the new property.
  • Click the cross cancel the property creation.
9
Add Object Property
  • Click the plus icon next to the object to create the new object property.
10
Save Object Property
  • Type a name, select a type and press the checkmark icon to save the object property.

Schema with object and object properties

Add in Object overview

Click the button on the left side of the screen and select the Objects tap to open the objects objects menu.

This menu allows to add, edit and delete objects.

Press next to an object to create object properties. Properties can be added to an object in the same way as they are added to a schema.

Enum

Add in Schema view

1
Add property
  • Click the plus icon on the right next to the schema name
  • E.g. on the right next to 'request'.
2
Property name
  • Pick a name for the property.
  • Type a name of choice in the name input.
The name can only contain lower case letters, white spaces and numbers.
This restriction exists in order to be able to translate the property name into code.
3
Property data type enum
  • Select 'enum' as property data type.
4
Create Enum
  • Click the plus next to the enum dropdown.
An enum is reusable and can be used as a type for multiple properties in multiple schemas.
5
Enum name
  • Pick a name for the enum.
  • Type a name of choice in the name input.
The name can only contain lower case letters, white spaces and numbers.
This restriction exists in order to be able to translate the object name into code.
6
Enum values
  • Type a value in the value input.
  • Press the plus icon to create the value.
  • Repeat for additional values.
The value can only contain lower case letters, white spaces and numbers.
This restriction exists in order to be able to translate the enum values into code.
7
Save the enum
  • Click the checkmark icon to create the new enum.
  • Click the cross cancel the enum creation.
8
Select Enum
  • Ensure the new created enum is selected in the enum dropdown.
9
Save the property
  • Click the checkmark icon to create the new property.
  • Click the cross cancel the property creation.

Schema with properties

Add in Enum overview

Click the button on the left side of the screen and select the Enums tap to open the objects menu.

This menu allows to add, edit and delete enums.

Copy a Schema

Copy a schema offers a fast way to duplicate properties from a schema to an other neighbouring schema.

All properties of the copied schema have a Schema Value Source of the original schema property.

Also Value Objects assigned to the properties will be copied.

1
Copy schema properties
  • Click the copy button, e.g. the 'copy to method' on the Command.
  • The 3 properties appear in the copy target schema, e.g. the Aggregate State.
The copied properties contain the Value Objects of the original properties.
Each copied property has a Schema Value Source of the original property.

Aggregate Method with a copy of the Commands properties and Value Sources


© 2024 Codebricks | All rights reserved.