Skip to content

Commit

Permalink
feat: update new client generation to include rest/rpc documentation … (
Browse files Browse the repository at this point in the history
#10078)

* feat: update new client generation to include rest/rpc documentation links

* update wording

* update new-client.py

* remove prompt for optional fields

* update to use new cloud drop fields
  • Loading branch information
alicejli committed Dec 19, 2023
1 parent 233e9c4 commit 120f75d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
14 changes: 10 additions & 4 deletions generation/new_client/README.md
Expand Up @@ -181,17 +181,23 @@ Example: `https://cloud.google.com/alloydb/docs`

### REST Docs

The corresponding value in the Cloud Drop page is `documentation_uri`.
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`
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`.
The corresponding value in the Cloud Drop page is `proto_reference_documentation_uri`.
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

Expand Down
17 changes: 17 additions & 0 deletions generation/new_client/new-client.py
Expand Up @@ -150,6 +150,16 @@ def main(ctx):
help="The URL of the repository that has generated Java code from proto "
"service definition"
)
@click.option(
"--rest-docs",
type=str,
help="If it exists, link to the REST Documentation for a service"
)
@click.option(
"--rpc-docs",
type=str,
help="If it exists, link to the RPC Documentation for a service"
)
def generate(
api_shortname,
name_pretty,
Expand All @@ -168,6 +178,8 @@ def generate(
owlbot_image,
library_type,
googleapis_gen_url,
rest_docs,
rpc_docs,
):
cloud_prefix = "cloud-" if cloud_api else ""

Expand Down Expand Up @@ -208,6 +220,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):
Expand Down

0 comments on commit 120f75d

Please sign in to comment.