From dcb0daefc84ef4cf5a2ca9d325abd85cf77487e2 Mon Sep 17 00:00:00 2001 From: Alice Li Date: Wed, 22 Nov 2023 16:46:56 -0500 Subject: [PATCH 1/5] feat: update new client generation to include rest/rpc documentation links --- generation/new_client/README.md | 14 ++++++++++---- generation/new_client/new-client.py | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/generation/new_client/README.md b/generation/new_client/README.md index 390dd1f5f22b..2d8c89376f29 100644 --- a/generation/new_client/README.md +++ b/generation/new_client/README.md @@ -172,17 +172,23 @@ Example: `https://cloud.google.com/alloydb/docs` ### REST Docs -The corresponding value in the Cloud Drop page is `documentation_uri`. +Not every library has these, as they are generated adhoc. Poke around the product docs link to see if there is a valid REST API reference link. The value must starts with "https://". -Example: `https://cloud.google.com/alloydb/docs` +Example: `https://cloud.google.com/alloydb/docs/reference/rest` + +If they exist, add them as a flag to the python command below like: +`--rest-docs="https://cloud.google.com/alloydb/docs/reference/rest" \` ### RPC Docs -The corresponding value in the Cloud Drop page is `documentation_uri`. +Not every library has these, as they are generated adhoc. Poke around the product docs link to see if there is a valid RPC API reference link. The value must starts with "https://". -Example: `https://cloud.google.com/alloydb/docs` +Example: `https://cloud.google.com/speech-to-text/docs/reference/rpc` + +If they exist, add them as a flag to the python command below like: +`--rpc-docs="https://cloud.google.com/speech-to-text/docs/reference/rpc" \` ### API description diff --git a/generation/new_client/new-client.py b/generation/new_client/new-client.py index 454451b62912..c8aadeb47e3f 100644 --- a/generation/new_client/new-client.py +++ b/generation/new_client/new-client.py @@ -150,6 +150,18 @@ def main(ctx): help="The URL of the repository that has generated Java code from proto " "service definition" ) +@click.option( + "--rest-docs", + type=str, + prompt="REST Documentation URL", + help="If it exists, link to the REST Documentation for a service" +) +@click.option( + "--rpc-docs", + type=str, + prompt="RPC Documentation URL", + help="If it exists, link to the RPC Documentation for a service" +) def generate( api_shortname, name_pretty, @@ -168,6 +180,8 @@ def generate( owlbot_image, library_type, googleapis_gen_url, + rest_docs, + rpc_docs, ): cloud_prefix = "cloud-" if cloud_api else "" @@ -211,6 +225,11 @@ def generate( if requires_billing: repo_metadata["requires_billing"] = True + if rest_docs: + repo_metadata["rest_documentation"] = rest_docs + + if rpc_docs: + repo_metadata["rpc_documentation"] = rpc_docs # Initialize workdir workdir = Path(f"{sys.path[0]}/../../java-{output_name}").resolve() if os.path.isdir(workdir): From 0ce4509e9e8aef7f7237723abfed85378bd85db9 Mon Sep 17 00:00:00 2001 From: Alice Li Date: Wed, 29 Nov 2023 14:13:56 -0500 Subject: [PATCH 2/5] update wording --- generation/new_client/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/generation/new_client/README.md b/generation/new_client/README.md index 2d8c89376f29..38edb0cff6a7 100644 --- a/generation/new_client/README.md +++ b/generation/new_client/README.md @@ -172,7 +172,8 @@ Example: `https://cloud.google.com/alloydb/docs` ### REST Docs -Not every library has these, as they are generated adhoc. Poke around the product docs link to see if there is a valid REST API reference link. +This link must be found manually (until b/310975675 is implemented), and may not exist for every library, as they are generated adhoc. +Poke around the product docs link to see if there is a valid REST API reference link. The value must starts with "https://". Example: `https://cloud.google.com/alloydb/docs/reference/rest` @@ -182,7 +183,8 @@ If they exist, add them as a flag to the python command below like: ### RPC Docs -Not every library has these, as they are generated adhoc. Poke around the product docs link to see if there is a valid RPC API reference link. +This link must be found manually (until b/310975675 is implemented), and may not exist for every library, as they are generated adhoc. +Poke around the product docs link to see if there is a valid RPC API reference link. The value must starts with "https://". Example: `https://cloud.google.com/speech-to-text/docs/reference/rpc` From 55140d42258de620e5026d68514e370225137a8e Mon Sep 17 00:00:00 2001 From: Alice Li Date: Wed, 29 Nov 2023 14:35:40 -0500 Subject: [PATCH 3/5] update new-client.py --- generation/new_client/new-client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generation/new_client/new-client.py b/generation/new_client/new-client.py index c8aadeb47e3f..fb296e45e3d7 100644 --- a/generation/new_client/new-client.py +++ b/generation/new_client/new-client.py @@ -153,12 +153,14 @@ def main(ctx): @click.option( "--rest-docs", type=str, + default=None, prompt="REST Documentation URL", help="If it exists, link to the REST Documentation for a service" ) @click.option( "--rpc-docs", type=str, + default=None, prompt="RPC Documentation URL", help="If it exists, link to the RPC Documentation for a service" ) From aba57ea5261e74b319a2d0022e3f2209e2eb9480 Mon Sep 17 00:00:00 2001 From: Alice Li Date: Wed, 29 Nov 2023 14:59:25 -0500 Subject: [PATCH 4/5] remove prompt for optional fields --- generation/new_client/new-client.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/generation/new_client/new-client.py b/generation/new_client/new-client.py index fb296e45e3d7..452c99605732 100644 --- a/generation/new_client/new-client.py +++ b/generation/new_client/new-client.py @@ -153,15 +153,11 @@ def main(ctx): @click.option( "--rest-docs", type=str, - default=None, - prompt="REST Documentation URL", help="If it exists, link to the REST Documentation for a service" ) @click.option( "--rpc-docs", type=str, - default=None, - prompt="RPC Documentation URL", help="If it exists, link to the RPC Documentation for a service" ) def generate( From d50c141e6822dc0219b205c2c452274b399058ba Mon Sep 17 00:00:00 2001 From: Alice Li Date: Mon, 18 Dec 2023 17:14:28 -0500 Subject: [PATCH 5/5] update to use new cloud drop fields --- generation/new_client/README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/generation/new_client/README.md b/generation/new_client/README.md index 38edb0cff6a7..f216d0294d96 100644 --- a/generation/new_client/README.md +++ b/generation/new_client/README.md @@ -172,8 +172,7 @@ Example: `https://cloud.google.com/alloydb/docs` ### REST Docs -This link must be found manually (until b/310975675 is implemented), and may not exist for every library, as they are generated adhoc. -Poke around the product docs link to see if there is a valid REST API reference link. +The corresponding value in the Cloud Drop page is `rest_reference_documentation_uri`. The value must starts with "https://". Example: `https://cloud.google.com/alloydb/docs/reference/rest` @@ -183,8 +182,7 @@ If they exist, add them as a flag to the python command below like: ### RPC Docs -This link must be found manually (until b/310975675 is implemented), and may not exist for every library, as they are generated adhoc. -Poke around the product docs link to see if there is a valid RPC API reference link. +The corresponding value in the Cloud Drop page is `proto_reference_documentation_uri`. The value must starts with "https://". Example: `https://cloud.google.com/speech-to-text/docs/reference/rpc`