the very common transformation that one wishes to carry out in a facade is to move up fields, distributed in the structure of a type, to a higher level.

Akwatype allows us to perform this type of operations with the statement with.

In this article we will work on this representation of the Person type.

The statement with, declared before the name of a field of complex type, indicates that one wishes to bring up the fields of the facade applied to this field to the level of the current facade.

facade PersonDTO on Person{
    name
    age
    with address{
        street
        city
    }
}

It is possible to use nested "with" to bring up fields placed deeper in the structure of type.

The application of aliases allows to rename the names of the fields that lost their meaning in this new context (country label for example)

facade PersonDTO on Person{
    name
    age
    with address{
        street
        city
        with country {
            country:label
        }
    }
}

The statement with can of course be applied on a field to which a non-inline facade has been applied (reuse of facade with :: followed by facade name)

facade PersonDTO on Person{
    name
    age
    with address::AddressDTO
}

facade AddressDTO on Address{
    street
    city
    with country {
        country:label
    }
}

The result is identical to the previous example using inline facades.