adrianhelvikspond opened a new pull request, #3014:
URL: https://github.com/apache/thrift/pull/3014

   <!-- Explain the changes in the pull request below: -->
   If a thrift struct has a membe named `read`, it causes a naming collision. 
This change renames `read` to `thriftRead` and `write` to `thriftWrite` on 
generated JavaScript classes.
   
   <!-- We recommend you review the checklist/tips before submitting a pull 
request. -->
   
   - [ ] Did you create an [Apache 
Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?  
([Request account here](https://selfserve.apache.org/jira-account.html), not 
required for trivial changes)
   - [ ] If a ticket exists: Does your pull request title follow the pattern 
"THRIFT-NNNN: describe my issue"?
   - [x] Did you squash your changes to a single commit?  (not required, but 
preferred)
   - [x] Did you do your best to avoid breaking changes?  If one was needed, 
did you label the Jira ticket with "Breaking-Change"?
   - [ ] If your change does not involve any code, include `[skip ci]` anywhere 
in the commit message to free up build resources.
   
   I reviewed the NodeJS library code to see if read or write was called 
directly on the generated classes:
   
   <details>
   <summary>`read` calls in NodeJS library</summary>
   
   ```
   ❯ rg '\.read\('
   binary_protocol.js
   193:    name = this.trans.read(sz);
   271:  var buff = this.trans.read(8);
   288:  return this.trans.read(len);
   
   compact_protocol.js
   727:  var buff = this.trans.read(8);
   769:  return this.trans.read(size);
   
   header_transport.js
   280:  this.read(endOfHeaders);
   ```
   </details>
   
   So `.read` is only called on the transports.
   
   <details>
   <summary>write calls in NodeJS library</summary>
   
   ```
   server.js
   49:            stream.write(buf); // TCP connection
   
   connection.js
   187:    self.write(data);
   ^ Connection.prototype
   196:  this.connection.write(data);
   ^ Connection.prototype
   387:    self.write(data);
   ^ StdIOConnection.prototype
   396:  this.connection.write(data);
   ^ StdIOConnection.prototype
   
   http_connection.js
   227:  req.write(data);
   ^ The http request
   
   multiplexed_protocol.js
   56:    connection.write(buf,seqid);
   ^ Third argument `connection` on Multiplexer.prototype.createClient. Assume 
this is Connection
   
   compact_protocol.js
   353:  this.trans.write(new Buffer([b]));
   428:  this.trans.write(buff);
   434:    this.trans.write(new Buffer(arg, encoding));
   441:    this.trans.write(arg);
   505:  this.trans.write(wbuf);
   539:  this.trans.write(wbuf);
   ^ Transport only
   
   header_transport.js
   89:  this.transport.write(str);
   316:  varintWriter.write(paddingBuffer);
   ^ Transport and VarIntHelper
   
   binary_protocol.js
   130:  this.trans.write(new Buffer([b]));
   134:  this.trans.write(binary.writeI16(new Buffer(2), i16));
   138:  this.trans.write(binary.writeI32(new Buffer(4), i32));
   143:    this.trans.write(i64.buffer);
   145:    this.trans.write(new Int64(i64).buffer);
   150:  this.trans.write(binary.writeDouble(new Buffer(8), dub));
   156:    this.trans.write(new Buffer(arg, encoding));
   163:    this.trans.write(arg);
   ^ Transport only
   
   create_client.js
   47:    connection.write(buf, seqid);
   ^ Connection
   
   web_server.js
   453:        response.write(file, "binary");
   ^ Http response
   468:          socket.write(frame);
   ^ Websocket
   518:      socket.write("HTTP/1.1 403 No Apache Thrift Service 
available\r\n\r\n");
   ^ Http socket
   524:    socket.write("HTTP/1.1 101 Switching Protocols\r\n" +
   ^ Http socket
   
   json_protocol.js
   99:    this.trans.write(this.tstack.pop());
   125:  this.trans.write(this.wbuf);
   ^ Transport
   ```
   </details>
   
   So `.write` is not called on generated classes here either.
   
   <!--
     The Contributing Guide at:
     https://github.com/apache/thrift/blob/master/CONTRIBUTING.md
     has more details and tips for committing properly.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@thrift.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to