The consideration of technical ids and traceability data is a recurring problem.

Many projects require this data on almost all types. However, these data "pollute" the representations with data that often have no business interest.

What we seek to avoid is this kind of representation where business data is drowned in more technical data.


The solution we propose is to group these data in a "Traceable" type (for example) and to create a traceable field on all types that need this information.

 

type Traceable{
   id:String
   updatedDate:DateTime
   updatedBy:String
   creationDate:DateTime
   createdBy:String
}

type Customer{
   traceable:Traceable
   name:String
   invoices:[invoice]  
   deliveryAddress:[Address]
}
type invoice{ traceable:Traceable num:String amount:Decimal meanOfPaiement:MeanOfPayment::(CreditCard,Check) }
type Address{ traceable:Traceable street:String city:String country:Country }

 

 

Then apply the isHiddenPropagatedToField property to the Traceable type.

This property tells akwatype that the type, and all fields pointing to this type, should be hidden by default. With this description we do have the technical fields described, they can be used in the facades, but they are no longer visible by default in the representations.

type Traceable{
   properties {
      isHiddenPropagatedToField: true
   }
   id:String
   updatedDate:DateTime
   updatedBy:String
   creationDate:DateTime
   createdBy:String
}

 

It is of course possible to make them appear in the data explorer by checking the box "Display hidden types"

 

 

 

 

 

Use of the Traceable type with the Using instruction

Another solution is to use the Traceable type with the using instruction

type Traceable{
   id:String
   updatedDate:DateTime
   updatedBy:String
   creationDate:DateTime
   createdBy:String
}

type Customer{
   using Traceable
   name:String
   invoices:[invoice]  
   deliveryAddress:[Address]
}
type invoice{ using Traceable num:String amount:Decimal meanOfPaiement:MeanOfPayment::(CreditCard,Check) }
type Address{ using Traceable street:String city:String country:Country }

 

In this case, Traceable fields will be imported by the using instruction in the type where the using instruction is used.

As in the first solution, if the isHiddenPropagatedToField property is set to true in the Traceable type, all these fields will be hidden by default.

 

👉 Using : how to reuse existing type to define a new type