# Object Model Uniqueness
To ensure object model uniqueness, the Ability Platform allows a type to have a list of properties that creates a uniqueness key:
{
"model": "model",
"typeId": "type",
"version": "1.0.0",
"unique": [ "serialNumber" ],
"properties": {
"serialNumber": {
"dataType": "string",
"isMandatory": true
}
}
}
Such a type guarantees that there will always be only one object model of that type with a given serialNumber.
The platform is structured to ensure that once uniqueness of an object model is defined by a parent type, all child types will inherit the same type and will be defined by no other type.
For object models created on types within one inheritance tree, uniqueness is enforced across all object models of types that inherit from the type where uniqueness is defined. This allows us to ensure that all objects created within one tree of types can be identified uniquely.
# TDR Validation Rules
The absence of a unique array is treated by the TDR as “no uniqueness is set”. This means that uniqueness may be defined in a child type.
When uniqueness is set, none of the further child types are allowed to redefine uniqueness (neither remove, nor add unique properties).
It is forbidden to explicitly define a 'unique' property for the type definition when it has already been defined by the parent type.
The type definition cannot inherit from two types that have uniqueness defined, even if the unique definitions of the types are the same.
The 'RelatedModels' validation stays as is and validation occurs via holistic representation of required type definitions.
Starting from the first inherited type definition where 'unique' was set, all type definition heirs will belong to the type named "unique group."
# IM Functionality
A unique property cannot be changed. This guarantees the object model of a certain type can be substituted with any object model of a child type.
An object model is unique by typeId and unique properties values if these are unique within the uniqueness group of the type definitions hierarchy.