Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update new client generation to include rest/rpc documentation … #10078

Merged
merged 6 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions generation/new_client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
alicejli marked this conversation as resolved.
Show resolved Hide resolved
The value must starts with "https://".

Example: `https://cloud.google.com/alloydb/docs`
Example: `https://cloud.google.com/alloydb/docs/reference/rest`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Example: `https://cloud.google.com/alloydb/docs/reference/rest`
Example: `https://cloud.google.com/alloydb/docs/reference/rest` in https://github.com/googleapis/googleapis/blob/master/google/cloud/alloydb/v1/alloydb_v1.yaml

But I didn't find the value in the YAML file. Is this a good example?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


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.
alicejli marked this conversation as resolved.
Show resolved Hide resolved
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
19 changes: 19 additions & 0 deletions generation/new_client/new-client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -168,6 +180,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 @@ -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):
Expand Down
Loading