Skip to content

Commit

Permalink
fix: use 'latest' version in generated package overview links (#273)
Browse files Browse the repository at this point in the history
* fix: use 'latest' version in generated package overview links

* fix: use equals for string comparisons

* ci: update goldens

* ci: update goldens

* chore: format
  • Loading branch information
burkedavison authored Jul 29, 2024
1 parent 06fb50e commit 57dfb42
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,7 @@ public PackageOverviewFile(
this.PACKAGE_HEADER = "# Package " + packageURIPath + " (" + artifactVersion + ")\n";

String cloudRADChildElementLinkPrefix =
"https://cloud.google.com/java/docs/reference/"
+ repoMetadata.getArtifactId()
+ "/"
+ artifactVersion
+ "/";
"https://cloud.google.com/java/docs/reference/" + repoMetadata.getArtifactId() + "/latest/";

String packageURIPathGithub = packageURIPath.replace('.', '/');
String githubSourcePackageLink =
Expand All @@ -110,14 +106,7 @@ public PackageOverviewFile(
+ "/src/main/java/"
+ packageURIPathGithub;

String cgcRootUri = "https://cloud.google.com/java/docs/reference/";
this.recommendedPackageLink =
cgcRootUri
+ repoMetadata.getArtifactId()
+ "/"
+ artifactVersion
+ "/"
+ this.recommendedPackage;
this.recommendedPackageLink = cloudRADChildElementLinkPrefix + this.recommendedPackage;
// If the package status is not a GA version, then add a disclaimer around prerelease
// implications
if (status != null) {
Expand Down Expand Up @@ -366,7 +355,7 @@ private String getUid() {
private static String createHtmlTable(
String type, String linkPrefix, List<PackageChildSummary> listOfPackageChildrenSummaries) {
String tableHeader = type;
if (type == "Client/Settings") {
if (type.equals("Client/Settings")) {
tableHeader = "Clients or Settings Class";
}
StringBuilder tableBuilder = new StringBuilder();
Expand All @@ -381,7 +370,7 @@ private static String createHtmlTable(
.append("</th>\n");

for (PackageChildSummary packageChildSummary : listOfPackageChildrenSummaries) {
if (packageChildSummary.type == type) {
if (packageChildSummary.type.equals(type)) {
tableBuilder
.append("<tr>\n")
.append("<td><a href=\"")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## This package is not the recommended entry point to using this client library!

For this library, we recommend using [com.microsoft.samples.google.v1](https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.v1) for new applications.
For this library, we recommend using [com.microsoft.samples.google.v1](https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.v1) for new applications.

## Classes
<table>
Expand All @@ -19,21 +19,21 @@ Class</th>
<th>
Description</th>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.agreements.AgreementDetailsCollectionOperations">com.microsoft.samples.agreements.AgreementDetailsCollectionOperations</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.agreements.AgreementDetailsCollectionOperations">com.microsoft.samples.agreements.AgreementDetailsCollectionOperations</a></td>
<td>

<strong>Deprecated.</strong> <em>Use <xref uid="AgreementMetaData" data-throw-if-not-resolved="false">AgreementMetaData</xref> instead.</em>

Agreement details collection operations implementation class.</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.agreements.AgreementMetaData">com.microsoft.samples.agreements.AgreementMetaData</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.agreements.AgreementMetaData">com.microsoft.samples.agreements.AgreementMetaData</a></td>
<td>
The AgreementMetaData provides metadata about the agreement type that partner can provide
confirmation of customer acceptance.</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.agreements.ResourceCollection">com.microsoft.samples.agreements.ResourceCollection</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.agreements.ResourceCollection">com.microsoft.samples.agreements.ResourceCollection</a></td>
<td>
Contains a collection of resources with JSON properties to represent the output Type of objects
in collection</td>
Expand All @@ -48,7 +48,7 @@ Interface</th>
<th>
Description</th>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.agreements.IAgreementDetailsCollection">com.microsoft.samples.agreements.IAgreementDetailsCollection</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.agreements.IAgreementDetailsCollection">com.microsoft.samples.agreements.IAgreementDetailsCollection</a></td>
<td>

<strong>Deprecated.</strong> <em>This one is deprecated :(</em>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## This package is not the recommended entry point to using this client library!

For this library, we recommend using [com.microsoft.samples.google.v1](https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.v1) for new applications.
For this library, we recommend using [com.microsoft.samples.google.v1](https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.v1) for new applications.

## Classes
<table>
Expand All @@ -19,22 +19,22 @@ Class</th>
<th>
Description</th>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.commentinheritance.Animal">com.microsoft.samples.commentinheritance.Animal</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.commentinheritance.Animal">com.microsoft.samples.commentinheritance.Animal</a></td>
<td>
Animal.</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.commentinheritance.Dog">com.microsoft.samples.commentinheritance.Dog</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.commentinheritance.Dog">com.microsoft.samples.commentinheritance.Dog</a></td>
<td>
Canine and man's best friend.</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.commentinheritance.Herbivorous.Plant">com.microsoft.samples.commentinheritance.Herbivorous.Plant</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.commentinheritance.Herbivorous.Plant">com.microsoft.samples.commentinheritance.Herbivorous.Plant</a></td>
<td>
</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.commentinheritance.Mammal">com.microsoft.samples.commentinheritance.Mammal</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.commentinheritance.Mammal">com.microsoft.samples.commentinheritance.Mammal</a></td>
<td>
Mammal.</td>
</tr>
Expand All @@ -48,27 +48,27 @@ Interface</th>
<th>
Description</th>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.commentinheritance.Carnivorous">com.microsoft.samples.commentinheritance.Carnivorous</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.commentinheritance.Carnivorous">com.microsoft.samples.commentinheritance.Carnivorous</a></td>
<td>
Marks an Animal that eats other animals.</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.commentinheritance.Herbivorous">com.microsoft.samples.commentinheritance.Herbivorous</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.commentinheritance.Herbivorous">com.microsoft.samples.commentinheritance.Herbivorous</a></td>
<td>
Marks animals that eat plants.</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.commentinheritance.Omnivorous">com.microsoft.samples.commentinheritance.Omnivorous</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.commentinheritance.Omnivorous">com.microsoft.samples.commentinheritance.Omnivorous</a></td>
<td>
Eats plants and animals.</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.commentinheritance.Organism">com.microsoft.samples.commentinheritance.Organism</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.commentinheritance.Organism">com.microsoft.samples.commentinheritance.Organism</a></td>
<td>
</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.commentinheritance.Viviparous">com.microsoft.samples.commentinheritance.Viviparous</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.commentinheritance.Viviparous">com.microsoft.samples.commentinheritance.Viviparous</a></td>
<td>
Mammals that give birth to young that develop within the mother's body.</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## This package is not the recommended entry point to using this client library!

For this library, we recommend using [com.microsoft.samples.google.v1](https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.v1) for new applications.
For this library, we recommend using [com.microsoft.samples.google.v1](https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.v1) for new applications.

## Client Classes
Client classes are the main entry point to using a package.
Expand All @@ -21,7 +21,7 @@ Client</th>
<th>
Description</th>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.SpeechClient">com.microsoft.samples.google.SpeechClient</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.SpeechClient">com.microsoft.samples.google.SpeechClient</a></td>
<td>
Service Description: Service that implements Google Cloud Speech API.

Expand All @@ -39,15 +39,15 @@ Settings</th>
<th>
Description</th>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.ProductSearchSettings">com.microsoft.samples.google.ProductSearchSettings</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.ProductSearchSettings">com.microsoft.samples.google.ProductSearchSettings</a></td>
<td>
Settings class to configure an instance of <xref uid="ProductSearchClient" data-throw-if-not-resolved="false">ProductSearchClient</xref>.

<p>The default instance has everything set to sensible defaults:
</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.SpeechSettings">com.microsoft.samples.google.SpeechSettings</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.SpeechSettings">com.microsoft.samples.google.SpeechSettings</a></td>
<td>
Settings class to configure an instance of <xref uid="SpeechClient" data-throw-if-not-resolved="false">SpeechClient</xref>.

Expand All @@ -64,20 +64,20 @@ Class</th>
<th>
Description</th>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.ProductSearchSettings.Builder">com.microsoft.samples.google.ProductSearchSettings.Builder</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.ProductSearchSettings.Builder">com.microsoft.samples.google.ProductSearchSettings.Builder</a></td>
<td>
Builder for ProductSearchSettings.</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.RecognitionAudio">com.microsoft.samples.google.RecognitionAudio</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.RecognitionAudio">com.microsoft.samples.google.RecognitionAudio</a></td>
<td>

Contains audio data in the encoding specified in the <code>RecognitionConfig</code>.
Either <code>content</code> or <code>uri</code> must be supplied. Supplying both or neither
returns <xref uid="google.rpc.Code.INVALID_ARGUMENT" data-throw-if-not-resolved="false">google.rpc.Code.INVALID_ARGUMENT</xref>. See</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.SpeechSettings.Builder">com.microsoft.samples.google.SpeechSettings.Builder</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.SpeechSettings.Builder">com.microsoft.samples.google.SpeechSettings.Builder</a></td>
<td>
Builder for SpeechSettings.</td>
</tr>
Expand All @@ -91,15 +91,15 @@ Interface</th>
<th>
Description</th>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.BetaApi">com.microsoft.samples.google.BetaApi</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.BetaApi">com.microsoft.samples.google.BetaApi</a></td>
<td>
Indicates a public API that can change at any time, and has no guarantee of API stability and
backward-compatibility.

<p>Usage guidelines:</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.ValidationException.Supplier">com.microsoft.samples.google.ValidationException.Supplier</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.ValidationException.Supplier">com.microsoft.samples.google.ValidationException.Supplier</a></td>
<td>
</td>
</tr>
Expand All @@ -113,7 +113,7 @@ Enum</th>
<th>
Description</th>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.RecognitionAudio.AudioSourceCase">com.microsoft.samples.google.RecognitionAudio.AudioSourceCase</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.RecognitionAudio.AudioSourceCase">com.microsoft.samples.google.RecognitionAudio.AudioSourceCase</a></td>
<td>
</td>
</tr>
Expand All @@ -127,7 +127,7 @@ Exception</th>
<th>
Description</th>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.ValidationException">com.microsoft.samples.google.ValidationException</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.ValidationException">com.microsoft.samples.google.ValidationException</a></td>
<td>
Exception thrown if there is a validation problem with a path template, http config, or related
framework methods. Comes as an illegal argument exception subclass. Allows to globally set a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Client</th>
<th>
Description</th>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.v1.SpeechClient">com.microsoft.samples.google.v1.SpeechClient</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.v1.SpeechClient">com.microsoft.samples.google.v1.SpeechClient</a></td>
<td>
Service Description: Service that implements Google Cloud Speech API.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

## This package is not the recommended entry point to using this client library!

For this library, we recommend using [com.microsoft.samples.google.v1](https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.v1) for new applications.
For this library, we recommend using [com.microsoft.samples.google.v1](https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.v1) for new applications.

## Stub Package Implications

This package is a a base stub class. It is for advanced usage and reflects the underlying API directly.
We generally recommend using the non-stub, latest GA package, such as [com.microsoft.samples.google.v1](https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.v1). Use with caution.
We generally recommend using the non-stub, latest GA package, such as [com.microsoft.samples.google.v1](https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.v1). Use with caution.
## Stub Classes
<table>
<tr>
Expand All @@ -23,21 +23,21 @@ Stub</th>
<th>
Description</th>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.v1.stub.GrpcSpeechStub">com.microsoft.samples.google.v1.stub.GrpcSpeechStub</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.v1.stub.GrpcSpeechStub">com.microsoft.samples.google.v1.stub.GrpcSpeechStub</a></td>
<td>
gRPC stub implementation for the Speech service API.

<p>This class is for advanced usage and reflects the underlying API directly.</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.v1.stub.HttpJsonSpeechStub">com.microsoft.samples.google.v1.stub.HttpJsonSpeechStub</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.v1.stub.HttpJsonSpeechStub">com.microsoft.samples.google.v1.stub.HttpJsonSpeechStub</a></td>
<td>
REST stub implementation for the Speech service API.

<p>This class is for advanced usage and reflects the underlying API directly.</td>
</tr>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.v1.stub.SpeechStub">com.microsoft.samples.google.v1.stub.SpeechStub</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.v1.stub.SpeechStub">com.microsoft.samples.google.v1.stub.SpeechStub</a></td>
<td>
Base stub class for the Speech service API.

Expand All @@ -54,7 +54,7 @@ Settings</th>
<th>
Description</th>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.v1.stub.SpeechStubSettings">com.microsoft.samples.google.v1.stub.SpeechStubSettings</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.v1.stub.SpeechStubSettings">com.microsoft.samples.google.v1.stub.SpeechStubSettings</a></td>
<td>
Settings class to configure an instance of <xref uid="com.google.cloud.speech.v1p1beta1.stub.SpeechStub" data-throw-if-not-resolved="false">com.google.cloud.speech.v1p1beta1.stub.SpeechStub</xref>.

Expand All @@ -71,7 +71,7 @@ Class</th>
<th>
Description</th>
<tr>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/0.18.0/com.microsoft.samples.google.v1.stub.SpeechStubSettings.Builder">com.microsoft.samples.google.v1.stub.SpeechStubSettings.Builder</a></td>
<td><a href="https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.microsoft.samples.google.v1.stub.SpeechStubSettings.Builder">com.microsoft.samples.google.v1.stub.SpeechStubSettings.Builder</a></td>
<td>
Builder for SpeechStubSettings.</td>
</tr>
Expand Down
Loading

0 comments on commit 57dfb42

Please sign in to comment.