Refactor swagger task