Comparing version 1.11.1 to 1.11.2
{ | ||
"name": "avro-js", | ||
"version": "1.11.1", | ||
"version": "1.11.2", | ||
"author": "Avro Developers <dev@avro.apache.org>", | ||
@@ -51,3 +51,3 @@ "description": "JavaScript Avro implementation", | ||
"jshint": "^2.13.4", | ||
"mocha": "10.0.0", | ||
"mocha": "10.2.0", | ||
"tmp": "^0.2.1" | ||
@@ -54,0 +54,0 @@ }, |
@@ -100,5 +100,46 @@ <!-- | ||
+ Implement recursive schemata (due to lack of duck-typing): | ||
```javascript | ||
// example type: linked list with one long-int as element value | ||
const recursiveRecordType = avro.parse({ | ||
"type": "record", | ||
"name": "LongList", | ||
"fields" : [ | ||
{"name": "value", "type": "long"}, | ||
{"name": "next", "type": ["null", "LongList"]} // optional next element via recursion | ||
] | ||
}); | ||
// will work | ||
const validRecursiveRecordDTO = { | ||
value: 1, | ||
next: { | ||
// no duck-typing support: from first nested level on the | ||
// recursive type has to be explicitly specified. | ||
LongList: { | ||
value: 2, | ||
next: null | ||
} | ||
} | ||
}; | ||
const serializedValid = recursiveRecordType.parse(validRecursiveRecordDTO); | ||
// will throw error | ||
const invalidRecursiveRecordDTO = { | ||
value: 1, | ||
next: { | ||
value: 2, | ||
next: null | ||
} | ||
}; | ||
const serializedInvalid = recursiveRecordType.parse(invalidRecursiveRecordDTO); | ||
``` | ||
[node.js]: https://nodejs.org/en/ | ||
[readable-stream]: https://nodejs.org/api/stream.html#stream_class_stream_readable | ||
[browserify]: http://browserify.org/ |
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
169648
145