-
Notifications
You must be signed in to change notification settings - Fork 129
Conversation
I think the print statement has been broken for quite a while... caught this failure in my mock tests. |
Codecov Report
@@ Coverage Diff @@
## master #1254 +/- ##
=========================================
Coverage 86.18% 86.18%
Complexity 3791 3791
=========================================
Files 380 380
Lines 15047 15047
Branches 1684 1684
=========================================
Hits 12968 12968
Misses 1628 1628
Partials 451 451 Continue to review full report at Codecov.
|
What is the failure? |
Don't have the exact stack trace, but something along the lines of |
Can you try puts JSON.pretty_generate {@class.pageStreaming.resourceVarName} instead of puts JSON.pretty_generate({@class.pageStreaming.resourceVarName}) ? |
I did, they're semantically the same, and result in the same failure |
Okay, that's what I thought. Seems to contradict documentation here: http://ruby-doc.org/stdlib-2.0.0/libdoc/json/rdoc/JSON.html#method-i-pretty_generate And examples here: |
I believe, BTW, that the failure is because the gem that handled the JSON conversion in the library ( I suppose I could dig through the client library to get the same behavior as before, but it's more work than I want to do at the moment, and it may also not be a bug... I also saw the posts you provided. When I get time I'll try to debug the implementation of |
Sure --- working is certainly better than not working, but it is uglier and IIUC produces less pretty output, so let's track in an issue. |
I'll file a bug to FWIW, the output is the same as it was before (it's still pretty printed as you'd expect), it's just that the route we take to convert it into a pretty string is different than before (first convert to hash, then unparse to json). I grabbed the stack trace:
|
* Fix JSON pretty print in Ruby sample (#1254) * Ruby: README Overhaul (feat. examples) (#1245) * go: use new metadata methods (#1262) Updates googleapis/google-cloud-go#624. metadata.FromContext and metdata.NewContext are replaced by metadata.{New,From}{Incoming,Outgoing}Context. Generated unit tests now verify that x-goog-api-client header is inserted. Additionally, clients now save a string slice containing x-goog-api-client header value instead of the value by itself. This is a small optimization so that we don't create a new slice every time. * Change media body from an object to a string (#1256) Samples fail before sending a request if the media body is an object. * Fix NONE auth Go sample (#1261) * Change Node.js unit test require. (#1264) * Ruby: Allow doc gapic generation to generate tests. (#1266) * Ruby: Remove aliasing from method samples and tests (#1253) * Ruby: Fix broken baselines from aliasing fix (#1269) * Remove unused code (#1270) * Python: README overhaul. (#1263) * Ruby: Update gemspec and add useful metadata files (#1258) * Ruby: Update gemspec and add useful metadata files * Specify HTTP client when constructing client (#1275) If a HTTP client is not passed to `build`, the Google API Python client will create a default one and attempt to authenticate it. This causes failures in environments where ADC auth is not available (Travis). In any case, it's not useful to access any auth code in the mock tests. This commit removes that possibility. * Fix JSON print in Ruby (#1274) It turns out that `to_h` is not a method available on every object returned by the samples at the moment. Also, there's some kind of decoding bug showing up in certain samples where the JSON module is unable to unparse the response. It's troublesome to have so much boilerplate just to pretty print. This commit removes the pretty calls in favor of the vanilla `to_json` method implemented by the base model class in the Ruby client. In the future, once the bugs w.r.t `pretty_generate` have been resolved, we can revert. * NodeJS: Update version index to support partial veneers (#1267) * NodeJS: Updates to package.json (#1268) * Migrate import disambiguation to Python MVVM (#1243) * Fix Node package.json (#1282) * go: use time.UnixNano instead of testutil.UIDSpace (#1279) Since generated code should be testable from api-client-staging repo, we want to reduce dependency on other cloud.google.com/go packages, especially internal ones. Clients will still depend on testutil for ProjID and TokenSource. This is OK, since they can be easily reimplemented in google-client-staging repo itself. * Update Java grpc metadata for new staging structure (#1265) * PHP: share credentials with operations client (#1283) * java: move CredentialProvider up to ClientSettings (#1251) This implements the client side changes to support googleapis/gax-java#305. * NodeJS: generate readme. (#1240) * NodeJS: Small additions to the package.json (#1289) * NodeJS: Use fileheader for copyright lines. (#1293) * NodeJS: Use correct casing for partial veneers (#1295) * NodeJS: Small readme fix from GCN reviews (#1294) * go: make longrunning methods use generated longrunning client (#1288) The cloud.google.com/go/longrunning package will need to change slightly to accomodate this change. xGoogHeader is now gone from the generated longrunnging types, as the header will be automatically inserted by LROClient itself. * NodeJS: Update partial veneer surface to add api documentation. (#1296) * NodeJS: Metadata updates. (#1298) * Readme: Update readme templates to add api summaries. (#1299) * Add PHP Exception tests (#951) * Add exception tests * Remove unnecessary checks in exception tests * Process markdown cloud links for PHP (#1091) * Process markdown cloud links for PHP * Restructure comment formatting * go: return error creating LRO client instead of panicking (#1300)
* merge master to Discogapic (#1304) * Fix JSON pretty print in Ruby sample (#1254) * Ruby: README Overhaul (feat. examples) (#1245) * go: use new metadata methods (#1262) Updates googleapis/google-cloud-go#624. metadata.FromContext and metdata.NewContext are replaced by metadata.{New,From}{Incoming,Outgoing}Context. Generated unit tests now verify that x-goog-api-client header is inserted. Additionally, clients now save a string slice containing x-goog-api-client header value instead of the value by itself. This is a small optimization so that we don't create a new slice every time. * Change media body from an object to a string (#1256) Samples fail before sending a request if the media body is an object. * Fix NONE auth Go sample (#1261) * Change Node.js unit test require. (#1264) * Ruby: Allow doc gapic generation to generate tests. (#1266) * Ruby: Remove aliasing from method samples and tests (#1253) * Ruby: Fix broken baselines from aliasing fix (#1269) * Remove unused code (#1270) * Python: README overhaul. (#1263) * Ruby: Update gemspec and add useful metadata files (#1258) * Ruby: Update gemspec and add useful metadata files * Specify HTTP client when constructing client (#1275) If a HTTP client is not passed to `build`, the Google API Python client will create a default one and attempt to authenticate it. This causes failures in environments where ADC auth is not available (Travis). In any case, it's not useful to access any auth code in the mock tests. This commit removes that possibility. * Fix JSON print in Ruby (#1274) It turns out that `to_h` is not a method available on every object returned by the samples at the moment. Also, there's some kind of decoding bug showing up in certain samples where the JSON module is unable to unparse the response. It's troublesome to have so much boilerplate just to pretty print. This commit removes the pretty calls in favor of the vanilla `to_json` method implemented by the base model class in the Ruby client. In the future, once the bugs w.r.t `pretty_generate` have been resolved, we can revert. * NodeJS: Update version index to support partial veneers (#1267) * NodeJS: Updates to package.json (#1268) * Migrate import disambiguation to Python MVVM (#1243) * Fix Node package.json (#1282) * go: use time.UnixNano instead of testutil.UIDSpace (#1279) Since generated code should be testable from api-client-staging repo, we want to reduce dependency on other cloud.google.com/go packages, especially internal ones. Clients will still depend on testutil for ProjID and TokenSource. This is OK, since they can be easily reimplemented in google-client-staging repo itself. * Update Java grpc metadata for new staging structure (#1265) * PHP: share credentials with operations client (#1283) * java: move CredentialProvider up to ClientSettings (#1251) This implements the client side changes to support googleapis/gax-java#305. * NodeJS: generate readme. (#1240) * NodeJS: Small additions to the package.json (#1289) * NodeJS: Use fileheader for copyright lines. (#1293) * NodeJS: Use correct casing for partial veneers (#1295) * NodeJS: Small readme fix from GCN reviews (#1294) * go: make longrunning methods use generated longrunning client (#1288) The cloud.google.com/go/longrunning package will need to change slightly to accomodate this change. xGoogHeader is now gone from the generated longrunnging types, as the header will be automatically inserted by LROClient itself. * NodeJS: Update partial veneer surface to add api documentation. (#1296) * NodeJS: Metadata updates. (#1298) * Readme: Update readme templates to add api summaries. (#1299) * Add PHP Exception tests (#951) * Add exception tests * Remove unnecessary checks in exception tests * Process markdown cloud links for PHP (#1091) * Process markdown cloud links for PHP * Restructure comment formatting * go: return error creating LRO client instead of panicking (#1300) * fails b/c Node.empty() uses null params * one test passes * all current tests pass * tests for Node parent() * Test * removed Method.empty(): * reordering methods for convention * made Node.from(Node, path) methods package private * removed path() from Document, Schema, and Method * removed static constructors with empty parent node
No description provided.