refactor templates composition, emit 'resourceType' attribute to JSON