Repository navigation
feat: generate samples - #2056
Conversation
9aa342d to
4b4c7f4
Compare
Codecov Report
@@ Coverage Diff @@
## master #2056 +/- ##
==========================================
+ Coverage 43.64% 49.88% +6.24%
==========================================
Files 7 9 +2
Lines 1219 1333 +114
Branches 22 21 -1
==========================================
+ Hits 532 665 +133
+ Misses 687 668 -19
Continue to review full report at Codecov.
|
b03ab86 to
daf1eb1
Compare
I wonder if we could show an async iterator in action, they simplify pagination a ton. |
|
@alexander-fenster @bcoe this is ready for a look for real |
| * // Do the magic | ||
| * const res = await abusiveexperiencereport.sites.get({ | ||
| * // Required. The name of the site whose summary to get, e.g. | ||
| * // `sites/http%3A%2F%2Fwww.google.com%2F`. |
There was a problem hiding this comment.
Is this supposed to be like this, or do we need | safe? (I really don't know)
There was a problem hiding this comment.
So I do use | safe. Turns out this is exactly what's in the source discovery doc 🤦
|
@bcoe I'm entirely open to adding the pagination stuff with async iterators. As a first step, we need to hand craft a sample with tests and such. Any concerns with punting that to a followup PR? |
bcoe
left a comment
There was a problem hiding this comment.
This is looking great to me.
One small concern, to address user issues with samples, will we now need to fix the issue both in discovery-artifact-manager and here. I would love for this to be the source of truth for Node.js apiary samples.
| * | ||
| * // Acquire an auth client, and bind it to all future calls | ||
| * const authClient = await auth.getClient(); | ||
| * google.options('auth', authClient); |
There was a problem hiding this comment.
I like that there are now inline examples, we should double check that our refdoc generator renders these appropriately at deploy time.
There was a problem hiding this comment.
Fun fact: inline samples are generally broken in compodoc 😭
compodoc/compodoc#304
The inline example is no more broken than it was before I guess? I think @fhinkel is working on a plan to save us
| {% if standalone %} | ||
| {% include "license.njk" %} | ||
|
|
||
| // THIS FILE IS AUTO-GENERATED |
There was a problem hiding this comment.
Hah, this is hand written - I want the files it generates to have that comment.
🤖 I have created a release \*beep\* \*boop\* --- ## [51.0.0](https://www.github.com/googleapis/google-api-nodejs-client/compare/v50.0.0...v51.0.0) (2020-05-13) ### ⚠ BREAKING CHANGES * run the generator (#2096) ### Features * generate samples ([#2056](https://www.github.com/googleapis/google-api-nodejs-client/issues/2056)) ([ea599ac](https://www.github.com/googleapis/google-api-nodejs-client/commit/ea599acb1a5adfdfe4efefdf701f19cc07963b70)) * run the generator ([#2096](https://www.github.com/googleapis/google-api-nodejs-client/issues/2096)) ([a89ca06](https://www.github.com/googleapis/google-api-nodejs-client/commit/a89ca0677d79c3dd0376459de77bdad3118d3f44)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please).
This PR removes the code that downloads sample snippets from GCS, and replaces it with an in-house generator. For reasons I don't fully understand, dartman was only generating samples for a small select number of APIs. It was easy enough to make this generic, so I rolled it out broadly.
The interesting files are at the bottom of the list, so scroll down
TODO:
After this lands:
Stuff to think about: