-
Notifications
You must be signed in to change notification settings - Fork 94
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
feat: add support for JSON data type #1368
Conversation
Here is the summary of changes. You are about to add 3 region tags.
This comment is generated by snippet-bot.
|
// array of objects that should be inserted into a JSON column. If we were | ||
// to specify this value as an array instead of a string, the client | ||
// library would encode this value as ARRAY<JSON> instead of JSON. | ||
VenueDetails: `[ |
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.
@zoercai Here's an example of the issue with top-level JSON arrays. The client library does not know whether this should be encoded as JSON
or ARRAY<JSON>
if it is specified as an actual array instead of a string. Specifying it as a string will cause the client library to just encode it as a string, which is the default encoding for JSON
values.
if (is.object(value)) { | ||
return JSON.stringify(value); | ||
} |
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 is where the most important part of this PR is: It ensures that any value that has been specified as an object will be converted to a valid JSON
string. An array of objects will be converted to an array of valid JSON
strings.
Codecov Report
@@ Coverage Diff @@
## master #1368 +/- ##
==========================================
- Coverage 98.60% 98.16% -0.44%
==========================================
Files 23 23
Lines 21950 21964 +14
Branches 1238 1219 -19
==========================================
- Hits 21644 21562 -82
- Misses 297 388 +91
- Partials 9 14 +5
Continue to review full report at Codecov.
|
@olavloite I just merged in the codegen PR so you can rebase this PR now. |
801c665
to
7a8331f
Compare
I added the Do not merge label back as the system test is failing with
|
Warning: This pull request is touching the following templated files:
|
Hi @olavloite, we're getting ready to merge the JSON PRs now for Node, Java, and Python. You can merge this PR as soon as all the tests pass. Could you please rebase and rerun CI? Thanks! |
54f54dc
to
58b046c
Compare
20903b8
to
f320042
Compare
@olavloite if you can please take a look at the test failure, that would be great. I ran it a couple of times and got the same error so I gathered it must be due to the new tests we added in this PR.
|
It was caused by a merge/rebase error. The previously added test runs for the tagging feature were also added once more by this PR, which meant that the tagging sample tests were executed twice. I've removed the duplicate test runs, and hopefully that should fix it. |
Now asked for help from the Node.js team on how to unblock the OwlBot check. |
* feat: support JSON data type * fix: remove unnecessary changes * fix: linting + skip tests on emulator * docs: simplify samples * feat: decorate commit error with additional information Decorate the error returned by a commit RPC in the specific case that the application tries to insert an array of objects into a JSON column. * test: add unit tests for decorateError * test: add test for deeply nested objects * test: add test for decoding complex JSON string * fix: typo * fix: run linter * fix: update expected query output * chore: run linter * chore: run linter * fix: remove duplicate tag test execution * fix: remove duplicate transaction tag test run Co-authored-by: skuruppu <skuruppu@google.com>
Adds support for
JSON
data type.