public LeaveGroupRequestData normalizedData() {
        if (version() >= 3) {
            return data;
        } else {
            return new LeaveGroupRequestData()
                .setGroupId(data.groupId())
                .setMembers(Collections.singletonList(
                    new MemberIdentity().setMemberId(data.memberId())));
        }
    }
Based on the request version to choose fields.
clients/src/main/java/org/apache/kafka/common/requests/LeaveGroupRequest.java