proto3-json-serializer
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -116,3 +116,3 @@ "use strict"; | ||
else if (fieldType.match(/^(?:(?:(?:u?int|fixed)(?:32|64))|float|double)$/)) { | ||
if (typeof value !== 'number') { | ||
if (typeof value !== 'number' && typeof value !== 'string') { | ||
throw new Error(`fromProto3JSONToInternalRepresentation: field ${key} of type ${field.type} cannot contain value ${value}`); | ||
@@ -119,0 +119,0 @@ } |
@@ -119,3 +119,3 @@ "use strict"; | ||
assert(value.constructor.name === 'Long', `toProto3JSON: don't know how to convert field ${key} with value ${value}`); | ||
result[key] = value.toNumber(); | ||
result[key] = value.toString(); | ||
continue; | ||
@@ -122,0 +122,0 @@ } |
@@ -12,3 +12,3 @@ /// <reference types="node" /> | ||
export interface LongStub { | ||
toNumber: () => number; | ||
toString: () => string; | ||
} |
@@ -28,3 +28,3 @@ "use strict"; | ||
assert(obj.value.constructor.name === 'Long', `wrapperToProto3JSON: expected to see a number, a string, a boolean, or a Long, but got ${obj.value}`); | ||
return obj.value.toNumber(); | ||
return obj.value.toString(); | ||
} | ||
@@ -31,0 +31,0 @@ return obj.value; |
# Changelog | ||
### [0.1.1](https://www.github.com/googleapis/proto3-json-serializer-nodejs/compare/v0.1.0...v0.1.1) (2021-08-04) | ||
### Bug Fixes | ||
* accept and return strings for int64 and uint64 ([#7](https://www.github.com/googleapis/proto3-json-serializer-nodejs/issues/7)) ([35689ec](https://www.github.com/googleapis/proto3-json-serializer-nodejs/commit/35689ecee55dbe6e4cf3327c535514d7fcb8332d)) | ||
## 0.1.0 (2021-08-03) | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "proto3-json-serializer", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"repository": "googleapis/proto3-json-serializer-nodejs", | ||
@@ -5,0 +5,0 @@ "description": "Support for proto3 JSON serialiazation/deserialization for protobuf.js", |
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
75576