Suppose we have the following type of vehicle description

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

and that we wanted to have a facade where the technical characteristics (engineCapacity, maximumSpeed, consumption) and the goodies (options, colors) are separated from the rest of the description

We can achieve that with following facades

  • VehicleDescriptionDTO
    • defines two additional fields on the same type (VehicleDescription) through the facades TechnicalCharacteristicsDTO and GoodiesDTO
    • retains only the brand, model and VIN fields
  • TechnicalCharacteristicsDTO retains only the fields concerning the technical characteristics
  • GoodiesDTO retains only the fields concerning the goodies
facade VehicleDescriptionDTO on VehicleDescription{
    additionalFields {
        technicalCharacteristics::TechnicalCharacteristicsDTO
        goodies::GoodiesDTO
    }
    brand
    model
    VIN
}
facade TechnicalCharacteristicsDTO on VehicleDescription{ engineCapacity maximumSpeed consumption } facade GoodiesDTO on VehicleDescription{ options color }

Json transformation example :