Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Nodeify Discovery objects #1322

Merged
merged 12 commits into from
Jun 5, 2017
Merged

Conversation

andreamlin
Copy link
Contributor

Document, Method, and Schema are all created from DiscoveryNodes, which should be part of a JSON tree structure. This PR unites Document, Method, and Schema under one Node interface, which exposes a method to get the parent of a node.

The ability to get the parent of a node is useful in the context it provides when operating on a single Node; ex. when transforming a Method, it would be easy to fetch the name "pubsub" from the parent Document node.

garrettjonesgoogle and others added 8 commits May 26, 2017 17:41
* Fix JSON pretty print in Ruby sample (googleapis#1254)

* Ruby: README Overhaul (feat. examples) (googleapis#1245)

* go: use new metadata methods (googleapis#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 (googleapis#1256)

Samples fail before sending a request if the media body is an object.

* Fix NONE auth Go sample (googleapis#1261)

* Change Node.js unit test require. (googleapis#1264)

* Ruby: Allow doc gapic generation to generate tests. (googleapis#1266)

* Ruby: Remove aliasing from method samples and tests (googleapis#1253)

* Ruby: Fix broken baselines from aliasing fix (googleapis#1269)

* Remove unused code (googleapis#1270)

* Python: README overhaul. (googleapis#1263)

* Ruby: Update gemspec and add useful metadata files (googleapis#1258)

* Ruby: Update gemspec and add useful metadata files

* Specify HTTP client when constructing client (googleapis#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 (googleapis#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 (googleapis#1267)

* NodeJS: Updates to package.json (googleapis#1268)

* Migrate import disambiguation to Python MVVM (googleapis#1243)

* Fix Node package.json (googleapis#1282)

* go: use time.UnixNano instead of testutil.UIDSpace (googleapis#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 (googleapis#1265)

* PHP: share credentials with operations client (googleapis#1283)

* java: move CredentialProvider up to ClientSettings (googleapis#1251)

This implements the client side changes to support
googleapis/gax-java#305.

* NodeJS: generate readme. (googleapis#1240)

* NodeJS: Small additions to the package.json (googleapis#1289)

* NodeJS: Use fileheader for copyright lines. (googleapis#1293)

* NodeJS: Use correct casing for partial veneers (googleapis#1295)

* NodeJS: Small readme fix from GCN reviews (googleapis#1294)

* go: make longrunning methods use generated longrunning client (googleapis#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. (googleapis#1296)

* NodeJS: Metadata updates. (googleapis#1298)

* Readme: Update readme templates to add api summaries. (googleapis#1299)

* Add PHP Exception tests (googleapis#951)

* Add exception tests
* Remove unnecessary checks in exception tests

* Process markdown cloud links for PHP (googleapis#1091)

* Process markdown cloud links for PHP
* Restructure comment formatting

* go: return error creating LRO client instead of panicking (googleapis#1300)
@codecov-io
Copy link

codecov-io commented Jun 3, 2017

Codecov Report

Merging #1322 into discogapic will increase coverage by 0.01%.
The diff coverage is 94.11%.

Impacted file tree graph

@@               Coverage Diff                @@
##             discogapic    #1322      +/-   ##
================================================
+ Coverage         85.02%   85.03%   +0.01%     
- Complexity         3821     3832      +11     
================================================
  Files               384      384              
  Lines             15522    15553      +31     
  Branches           1698     1705       +7     
================================================
+ Hits              13198    13226      +28     
- Misses             1874     1877       +3     
  Partials            450      450
Impacted Files Coverage Δ Complexity Δ
.../java/com/google/api/codegen/discovery/Schema.java 90.78% <100%> (+1.39%) 13 <3> (+5) ⬆️
.../java/com/google/api/codegen/discovery/Method.java 93.02% <100%> (+2.7%) 13 <3> (+5) ⬆️
...ava/com/google/api/codegen/discovery/Document.java 86.88% <82.35%> (-3.5%) 12 <1> (+1)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41e4791...866b09f. Read the comment docs.

}

// Package private for use by other Node objects.
void setParent(Node parent) {

This comment was marked as spam.

This comment was marked as spam.

@@ -66,23 +68,35 @@ public static Document from(DiscoveryNode root) {
String servicePath = root.getString("servicePath");
String title = root.getString("title");
String version = root.getString("version");
String id = root.getString("id");

This comment was marked as spam.

This comment was marked as spam.

Node parent();

/** @return the ID of this node. */
String id();

This comment was marked as spam.

This comment was marked as spam.

isEnum,
items,
location,
path,

This comment was marked as spam.

This comment was marked as spam.

@saicheems
Copy link
Contributor

Nice work! This is a very useful interface.


/** @return whether or not to version the module. */
@JsonProperty("id")
public abstract String id();

This comment was marked as spam.

This comment was marked as spam.

@@ -38,6 +38,17 @@
* @return a method.
*/
public static Method from(DiscoveryNode root, String path) {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -133,6 +147,22 @@ public Schema dereferenceSchema(Schema schema) {
}

/** @return the auth instructions URL. */
@JsonIgnore @Nullable private Node parent;

This comment was marked as spam.

This comment was marked as spam.

@andreamlin
Copy link
Contributor Author

Addressed comments. PTAL

@saicheems
Copy link
Contributor

lgtm

@andreamlin andreamlin merged commit f50074f into googleapis:discogapic Jun 5, 2017
@andreamlin andreamlin deleted the nodeify_schema branch June 15, 2017 17:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants