-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(diregapic): support int64 conversion between the pf message and JSON object #1028
Conversation
decodedRequest | ||
decodedRequest, | ||
{ | ||
longs: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add enums: String
here too? This will make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hesitated yesterday. I will add here.
BTW, I didn't test this lines. No need to test this request conversion, it covered by Message.toObject
; This expect to replace by use toJSON
soon.
test/unit/regapic.ts
Outdated
author: 'book-author', | ||
title: 'book-title', | ||
read: true, | ||
bookId: '9007199254740992', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be my ignorance of this testing framework, but is there a place where you set the book to be an int64 and see it encoded as a string? (Asking because all the bookId
s here look like strings...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I removed the quote.
Book Message with value is
Book {
name: 'book-name',
author: 'book-author',
title: 'book-title',
read: true,
bookId: Long { low: 0, high: 2097152, unsigned: false }
}
Convert to JSON object
{
name: 'book-name',
author: 'book-author',
title: 'book-title',
read: true,
bookId: '9007199254740992'
}
@summer-ji-eng I added one commit that adds a call to |
🤖 I have created a release \*beep\* \*boop\* --- ### [2.15.1](https://www.github.com/googleapis/gax-nodejs/compare/v2.15.0...v2.15.1) (2021-06-17) ### Bug Fixes * support int64 conversion between the pf message and JSON object ([#1028](https://www.github.com/googleapis/gax-nodejs/issues/1028)) ([b46f57d](https://www.github.com/googleapis/gax-nodejs/commit/b46f57dcf88d70f9b8b3fcd5119dd68e02b6a71a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Add unit test for enum conversion #1028
Similar to #1015, support int64 conversion from protobuf message to JSON object.
protobufjs
Message.toObject(message: Message [, options: ConversionOptions]): Object
converts a message instance to an arbitrary plain JavaScript object for interoperability with other libraries or storage. The resulting plain JavaScript object might still satisfy the requirements of a valid message depending on the actual conversion options specified, but most of the time it does not.