public List<MemberIdentity> members() {
        // Before version 3, leave group request is still in single mode
        return version() <= 2 ? Collections.singletonList(
            new MemberIdentity()
                .setMemberId(data.memberId())) : data.members();
    }
Based on the request version to choose fields.
clients/src/main/java/org/apache/kafka/common/requests/LeaveGroupRequest.java