Visitar URL original
docs: update new client generation instructions (#9931) · googleapis/google-cloud-java@233e9c4 · GitHub
Skip to content

Commit 233e9c4

Browse files
authored
docs: update new client generation instructions (#9931)
* docs: update new client generation instructions * clarify * reword * reword
1 parent 3f7dd12 commit 233e9c4

2 files changed

Lines changed: 34 additions & 3 deletions

File tree

‎generation/new_client/README.md‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,19 @@ The example in this README uses AlloyDB's [Cloud Drop](https://github.com/google
137137
### API short name
138138

139139
For convenience of the subsequent commands, define a variable for API short name.
140+
This value will be used by default to generate the following:
141+
* `--distribution-name`
142+
* `--destination-name`
143+
140144
The corresponding value in the Cloud Drop page is `api_short_name`.
141145

142146
Example: `alloydb`
143147

148+
> [!IMPORTANT]
149+
> `api_short_name` is not always unique across client libraries.
150+
> In the instance that the `api_short_name` is already in use by an existing client library, you will need to determine a unique name.
151+
> See example under [Advanced Options](#Example with duplicate api_short_name).
152+
144153
### Proto path
145154

146155
The script takes "proto path" parameter. This is the path from the internal `google3/third_party/googleapis/stable` root to the
@@ -312,6 +321,31 @@ generated Google Maps Routes API Java client library.
312321
--requires-billing=true \
313322
--distribution-name="com.google.maps:google-maps-routing"
314323
```
324+
### Example with duplicate api_short_name
325+
326+
Let's say you get a new library request where the Cloud Drop value for `api_short_name` is `maps-routing`.
327+
328+
You discover that `maps-routing` is already in use by an existing client library!
329+
330+
You need to determine a unique `destination_name` for the new library's subdirectory as well as a unique `distribution_name` for the artifact to be published. There is no hard and fast rule for determining a unique name, so some discussion will be necessary. Confirm the `distribution_name` with the service team on the buganizer ticket before proceeding, as this name is visible to customers as the Maven artifact name.
331+
332+
You will **still use** the non-unique `api_short_name` for the `api_short_name` flag. This is important because the `api_short_name` is used to derive links within cloud.google.com to enable the API.
333+
334+
Let's say that after some discussion, `maps-routing-gps` is selected as a suitable unique subdirectory name and `com.google.maps:google-maps-routing-gps` is selected as a suitable unique artifact name. You would then use the following command:
335+
336+
```
337+
~/google-cloud-java$ python3.9 generation/new_client/new-client.py generate \
338+
--api_shortname=maps-routing \
339+
--proto-path=google/maps/routing \
340+
--name-pretty="Routes API" \
341+
--product-docs="https://developers.google.com/maps/documentation/routes" \
342+
--api-description="Routes API is the next generation, performance optimized version of the existing Directions API and Distance Matrix API. It helps you find the ideal route from A to Z, calculates ETAs and distances for matrices of origin and destination locations, and also offers new features." \
343+
--api-id=routes.googleapis.com \
344+
--cloud-api=false \
345+
--requires-billing=true \
346+
--distribution-name="com.google.maps:google-maps-routing-gps" \
347+
--destination-name="maps-routing-gps"
348+
```
315349

316350
# Principles
317351

‎generation/new_client/new-client.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,6 @@ def generate(
187187
f"https://cloud.google.com/{language}/docs/reference/{distribution_name_short}/latest/overview"
188188
)
189189

190-
if proto_path is None:
191-
proto_path = f"/google/cloud/{api_shortname}"
192-
193190
if api_shortname == "":
194191
sys.exit("api_shortname is empty")
195192

0 commit comments

Comments
 (0)