In the standard way a field of a facade is selected among the fields of the type on which the facade is declared

However, sometimes we need to declare fields that do not belong to the type model.

  • either because it is data (technical for example) that we do not want to see in the business-oriented type model,
  • or because the facade organizes the fields differently from the type model.

Additional fields

To add fields specifically to a facade Akwatype has the statement additionnalFields { }

  • All fields declared in this block will be added to the facade.
  • The properties of these additional fields are the same as those of the type fields.

 

facade PersonDTO on Person{
    additionalFields {
        surname : String{ maxLength: 30 }
tempAddress : Address }
name # from Person firstName # from Person }

 

 

The type of an additional field can be of any valid Akwatype type.

  • surname : String
  • address2 : Address

The type of the field can also be omitted and a facade directly associated to the field (with ::) at the time of its declaration.

  • address2 :: AddressDTO

 

facade PersonDTO on Person{
    additionalFields {
        surname:String{ maxLength: 30 }
tempAddress :: AddressDTO }
name # from Person firstName # from Person }

 

The additional fields can be used as normal fields in the list of fields of the facade. This allows you to reposition them in the list of fields (by default they are added after the selected fields in the facade) and eventually apply an inline facade to them

facade PersonDTO on Person{
    additionalFields {
        surname:String{ maxLength: 30 }
        tempAddress::Address
    }

name # from Person surname firstName # from Person tempAddress{ street town:city countryCode:country.codeISO } }

 

Warning:

As the additional fields are not linked to the type model, they are not automatically taken into account by facade transformations.
To be taken into account, they must either be based on existing fields (basedOn) or be the target of a transformation using dispatch for example.