Refactor method signature for buildMapFromSpec