Instead of implementing the logic explicitly for types which are arrays, just redirect them to /complexType and put the logic in a template which is already more expressive and flexible and handles what I need.