thriftrw / thriftrw-node

A thrift binary encoding library using bufrw
MIT License
57 stars 25 forks source link

Service arguments parse error #163

Open lushijie opened 6 years ago

lushijie commented 6 years ago
// m21.thrift file
struct Code {
  1: string abc
}

// m2.thrift file
include 'm21.thrift'
service Test {
  void ping(m21.Code a);
}

parse error message:

 assert(def.isResult || def.id.value > 0,
                                  ^

TypeError: Cannot read property 'value' of null
    at new ThriftField (/Users/lushijie/github/thrift-json/node_modules/thriftrw/struct.js:40:35)
    at ThriftStruct.compile (/Users/lushijie/github/thrift-json/node_modules/thriftrw/struct.js:122:21)
    at Thrift.compileStruct (/Users/lushijie/github/thrift-json/node_modules/thriftrw/thrift.js:307:11)
kriskowal commented 6 years ago

Thank you for submitting! We should make this error more informative. I believe you need to add a field number to the ping argument. ping(1: m21.Code a).

lushijie commented 6 years ago

Yes, that's right , Thank you.

Because it's a project long long ago, there are so many style of writing. When I use thrift 0.11.0 it just throw WARNING like:

[WARNING: /xx/demo/case/m2.thrift:4] No field key specified for a, resulting protocol may have conflicts or not be backwards compatible!

So if thriftrw-node throw warning like thrift would be better .