Refactor for DRY on api spec