Suppose we have the following type of vehicle description

type Vehicle{
    licensePlate:String
    description:VehicleDescription
}

type VehicleDescription {
    brand:String
    model:String
    VIN:String
    engineCapacity:String
    maximumSpeed:Integer
    consumption:Decimal
    options:[String]
    color:String
}

and that we wanted a facade with the description field to be split into three fields: identification, features and goodies.

We can achieve that with following facades

  • VehicleDTO
    • defines three additional fields on the same type as description (VehicleDescription) through the facades VehicleIndentificationDTO, VehicleCharacteristicDTO and VehicleGoodiesDTO
    • The three fields fill the basedOn property with the description field to indicate that these three fields are mapped to the content of the description field
    • retains licencePlate fields
  • VehicleIndentificationDTO retains only the fields concerning the identification
  • VehicleCharacteristicDTO retains only the fields concerning the technical characteristics
  • GoodiesDTO retains only the fields concerning the goodies
facade VehicleDTO on Vehicle{
    additionalFields {
        indentification::VehicleIndentificationDTO {basedOn: description}
        characteristic::VehicleCharacteristicDTO {basedOn: description}
        goodies::VehicleGoodiesDTO {basedOn: description}
    }
    licensePlate
}

facade VehicleIndentificationDTO on VehicleDescription{
    brand:brand
    model
    VIN
}
facade VehicleCharacteristicDTO on VehicleDescription{ engineCapacity     maximumSpeed consumption } facade VehicleGoodiesDTO on VehicleDescription{ options:options color }