GeezerVison is showing github.com — Tabbed view with examples in landing page by mziccard · Pull Request #191 · googleapis/google-cloud-java
Conversation
This PR addresses #129.
- Add a tabbed view for examples in the landing page
- Example for Compute/App Engine is kept as is, while I added an example for using the library outside of Compute/App Engine
- Add highlight.js to handle code formatting
Notes: the example uses AuthCredentials.createForJson so we should not update previous versions sites. If I am not mistaken Travis will use the new files from this PR for the next release.
You can have a look at the page here, comments are more than welcome.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Hmm - looks like we lost some of the syntax highlighting in that demo?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@jgeewax You are right I forgot to add custom highlighting for constants. Could you double-check now?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
As much as I hate how long we need our snippet to be (!) -- this LGTM :)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Nice.
In AE and CE one also does not have to supply projectid. see here.
As of now, snapshot releases are only pushed maven (snapshot repository) and non snapshot releases are pushed to maven as well as creating and updating the site. So, I don't think this will be pushed by Travis as is. see here.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@aozarov Yes, I meant that Travis detects when a release is pushed through $SITE_VERSION and only in that case builds (and publishes) the site for the new release. It this right? Merging this PR does not trigger any site build so older versions sites remain unchanged.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@mziccard Right, however if we want it sooner than later we could push it manually (in a separate PR).
Do you still want to keep the explicit projectid for CE and AE? I think omitting it is nicer and consistent with not supplying the auth (that is tied for that project)....
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Great, thanks. Why the empty line between options assignment and datastore?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
It's just there to separate the "environment" dependent part from the more functional one. Basically after the line the code is the same in all environments (and in the 2 tabs). But I am not particularly attached to it, so I can drop it if you prefer.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
+1 to remove that empty line.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks! another nit. Do you mind to change the CE/AE version to have only one line separator between imports and the code (similar to the other one).
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I'm +1 to keeping a line separating env setup from Datastore specific
stuff......
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I am -1 for that. The setup is actually service specific (each service has its own options, though they share a common code for setting common stuff).
DatastoreOptions options = DatastoreOptions.builder().build();
Datastore datastore = DatastoreFactory.instance().get(options);
KeyFactory keyFactory = datastore.newKeyFactory().kind(KIND);
...
That empty line between DatastoreOptions construction and Datastore construction seems wrong to me (and normally will not appear in user code). Instead, if we must, I would have a comment.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The way you have it written I'd far more readable to me....
It's already super long... I think a giant blob of text like that needs a
little spacing... Like separate paragraphs in GH.
Do we have a style guide reference saying they should be all one
"paragraph"?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The way I mentioned above is less readable to me (though I would not go as much as saying far) :)
We don't use spacing in this particular case in our code (test or samples).
This is what the Java style guide has to say about empty lines: vertical-whitespace.
You may argue that "Within method bodies, as needed to create logical groupings of statements." falls in this category but I think that is a weak argument. I would say that a space between constructing a service and using it would make more sense to me.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I think that's exactly the argument... Logical grouping of statements....
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Ok, than you have my answer/opinion.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
So what do we do then?:) Maybe @ajkannan can give us a third opinion.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
You can wait to get more opinions like @ajkannan or just decide yourself.
I think, this is a minor issue and can always be changed later (so the decision should
not block this PR).
Just to make my opinion clear is that I think current state should be change to:
- Only 1 empty line between import and code, but more importantly be consistent in both examples.
- No need for an empty line after
DatastoreOptions creation (my top preference) or have another empty line after Datastore creation or have an empty line only after DatastoreOptions and Datastore creation.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I have a slight preference towards one line to separate the imports from code (and no other empty lines), but either way wouldn't be abhorrent in my book :)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I updated last commit to remove the additional unnecessary line. You can see the updated version here.
There are 2 empty lines at the end of the CE/AE code to match the length of the "elsewhere" example. Otherwise the code box size changes everytime tab is changed, which is quite ugly:)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
aozarov
added a commit
that referenced
this pull request
Oct 1, 2015
Tabbed view with examples in landing page
github-actions Bot
pushed a commit
that referenced
this pull request
Jul 1, 2022
Making CLIRR not required. The version bumps are now controlled by the Release Please and OwlBot. The CL authors create appropriate change description to control major version bumps.
suztomo
pushed a commit
to suztomo/google-cloud-java
that referenced
this pull request
Mar 11, 2026
suztomo
pushed a commit
to suztomo/google-cloud-java
that referenced
this pull request
Mar 23, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
cla: yes
This human has signed the Contributor License Agreement.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|