Comparing version 3.11.0 to 3.11.1
@@ -0,1 +1,6 @@ | ||
# v3.11.1 | ||
- Propagate defaultAsUndefined to dependent Thrift constructors so that imported structs | ||
will respect the configuration of the root Thrift object. | ||
# v3.11.0 | ||
@@ -2,0 +7,0 @@ |
{ | ||
"name": "thriftrw", | ||
"version": "3.11.0", | ||
"version": "3.11.1", | ||
"description": "thrift encoding/decoding using bufrw", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -28,7 +28,7 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
var path = require('path'); | ||
var source = fs.readFileSync(path.join(__dirname, 'default.thrift'), 'ascii'); | ||
var entryIdl = path.join(__dirname, 'default.thrift'); | ||
var model; | ||
test('default values on structs work', function t(assert) { | ||
model = new Thrift({source: source}); | ||
model = new Thrift({entryPoint: entryIdl, allowFilesystemAccess: true}); | ||
var health = new model.Health({name: 'grand'}); | ||
@@ -40,2 +40,3 @@ assert.equals(health.ok, true, 'default truth value passes through'); | ||
assert.equals(health.respected, null, 'null is default value'); | ||
assert.equals(health.ragdoll, null, 'null is default value for dependent thrifts'); | ||
assert.deepEquals(health.numbers, [1, 2, 3], 'complex defaults serialize'); | ||
@@ -46,6 +47,7 @@ assert.end(); | ||
test('default value as undefined respected in constructor', function t(assert) { | ||
model = new Thrift({source: source, defaultAsUndefined: true}); | ||
model = new Thrift({entryPoint: entryIdl, allowFilesystemAccess: true, defaultAsUndefined: true}); | ||
var health = new model.Health({name: 'grand'}); | ||
assert.equals(health.respected, undefined, 'undefined as default value'); | ||
assert.equals(health.ragdoll, undefined, 'undefined as default value for dependent thrifts'); | ||
assert.end(); | ||
}); |
@@ -88,2 +88,3 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
this.defaultValueDefinition = new Literal(options.defaultAsUndefined ? undefined : null); | ||
this.defaultAsUndefined = options.defaultAsUndefined; | ||
@@ -287,3 +288,4 @@ // [name] :Thrift* implementing {compile, link, &c} | ||
allowOptionalArguments: this.allowOptionalArguments, | ||
noLink: true | ||
noLink: true, | ||
defaultAsUndefined: this.defaultAsUndefined | ||
}); | ||
@@ -290,0 +292,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
734741
154
15425