public static LeaveGroupRequest parse(ByteBuffer buffer, short version) {
        return new LeaveGroupRequest(new LeaveGroupRequestData(new ByteBufferAccessor(buffer), version), version);
    }
Based on the request version to choose fields.
clients/src/main/java/org/apache/kafka/common/requests/LeaveGroupRequest.java