Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3857

thrift js:node complier support an object as parameter not an instance of struct

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9.3, 0.10.0
    • 0.11.0
    • Node.js - Compiler
    • None

    Description

      use the tutorial.thrift,code like:

      let param = {
        op: ttypes.Operation.DIVIDE,
        num1: 1,
        num2: 0
      }
      
      let work = new ttypes.Work(param);
      
      client.calculate(1, work)
        .then(function(message) {
      	console.log('Whoa? You know how to divide by zero?');
        })
        .fail(function(err) {
          console.log("InvalidOperation " + err);
        });
      

      can we support like these:

      let work = {
        op: ttypes.Operation.DIVIDE,
        num1: 1,
        num2: 0
      }
      
      client.calculate(1, work)
        .then(function(message) {
      	console.log('Whoa? You know how to divide by zero?');
        })
        .fail(function(err) {
          console.log("InvalidOperation " + err);
        });
      

      If we can support this feature will be very convenient, and I have read the 't_js_generator.cc' file, find this feature is easy to support, can we add the support for this feature?

      Attachments

        Issue Links

          Activity

            People

              jking3 James E. King III
              leaves4j jiangq
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: