From 69ecec8f86c9b760b50e63095a97dceb65c5e8c1 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 17:50:11 +0000 Subject: [PATCH 01/20] build: fetch discovery artifacts from discovery-artifact-manager --- describe.py | 26 ++++++++++++++++++++------ noxfile.py | 3 ++- scripts/updatediscoveryartifacts.py | 5 +++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/describe.py b/describe.py index e8f2ab26372..10a604c0e91 100644 --- a/describe.py +++ b/describe.py @@ -390,7 +390,7 @@ def document_collection_recursive( def document_api( - name, version, uri, doc_destination_dir, artifact_destination_dir=DISCOVERY_DOC_DIR + name, version, uri, doc_destination_dir, artifact_destination_dir=DISCOVERY_DOC_DIR, discovery_uri_template=None ): """Document the given API. @@ -402,14 +402,23 @@ def document_api( documentation should be saved. artifact_destination_dir (str): relative path where the discovery artifacts should be saved. + discovery_uri_template (str): URI template of the API's discovery document. + If this parameter is set, the `uri` parameter is ignored and the uri + will be created from this template. """ - http = build_http() - resp, content = http.request( - uri - or uritemplate.expand( + # Use the discovery_uri_template to create the uri if provided + if discovery_uri_template: + uri = uritemplate.expand( + discovery_uri_template, {"api": name, "apiVersion": version} + ) + + if not uri: + uritemplate.expand( FLAGS.discovery_uri_template, {"api": name, "apiVersion": version} ) - ) + + http = build_http() + resp, content = http.request(uri) if resp.status == 200: discovery = json.loads(content) @@ -494,6 +503,7 @@ def generate_all_api_documents( directory_uri=DIRECTORY_URI, doc_destination_dir=BASE, artifact_destination_dir=DISCOVERY_DOC_DIR, + discovery_uri_template=None, ): """Retrieve discovery artifacts and fetch reference documentations for all apis listed in the public discovery directory. @@ -503,6 +513,9 @@ def generate_all_api_documents( documentation should be saved. artifact_destination_dir (str): relative path where the discovery artifacts should be saved. + discovery_uri_template (str): URI template of the API's discovery document. + If this parameter is set, the `uri` parameter is ignored and the uri + will be created from this template. """ api_directory = collections.defaultdict(list) http = build_http() @@ -516,6 +529,7 @@ def generate_all_api_documents( api["discoveryRestUrl"], doc_destination_dir, artifact_destination_dir, + discovery_uri_template, ) api_directory[api["name"]].append(api["version"]) diff --git a/noxfile.py b/noxfile.py index 767def37953..b0f7f2d5a00 100644 --- a/noxfile.py +++ b/noxfile.py @@ -135,13 +135,14 @@ def scripts(session): session.install("-r", "scripts/requirements.txt") # Run py.test against the unit tests. + # TODO(https://github.com/googleapis/google-api-python-client/issues/2132): Add tests for describe.py session.run( "py.test", "--quiet", "--cov=scripts", "--cov-config=.coveragerc", "--cov-report=", - "--cov-fail-under=91", + "--cov-fail-under=90", "scripts", *session.posargs, ) diff --git a/scripts/updatediscoveryartifacts.py b/scripts/updatediscoveryartifacts.py index fd663480b74..7e5391a2979 100644 --- a/scripts/updatediscoveryartifacts.py +++ b/scripts/updatediscoveryartifacts.py @@ -23,6 +23,9 @@ import describe SCRIPTS_DIR = pathlib.Path(__file__).parent.resolve() +# Obtain the discovery index and artifacts from googleapis/discovery-artifact-manager +DIRECTORY_URI = "https://raw.githubusercontent.com/googleapis/discovery-artifact-manager/master/discoveries/index.json" +DISCOVERY_URI_TEMPLATE = "https://raw.githubusercontent.com/googleapis/discovery-artifact-manager/master/discoveries/{api}.{apiVersion}.json" DISCOVERY_DOC_DIR = ( SCRIPTS_DIR / ".." / "googleapiclient" / "discovery_cache" / "documents" ) @@ -46,8 +49,10 @@ # Download discovery artifacts and generate documentation describe.generate_all_api_documents( + directory_uri=DIRECTORY_URI, doc_destination_dir=REFERENCE_DOC_DIR, artifact_destination_dir=DISCOVERY_DOC_DIR, + discovery_uri_template=DISCOVERY_URI_TEMPLATE, ) # Get a list of files changed using `git diff` From 1f9d58f1dc443509da39e33750c1c7ebde1f997b Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 17:52:38 +0000 Subject: [PATCH 02/20] remove comment --- describe.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/describe.py b/describe.py index 10a604c0e91..06e465bf1ba 100644 --- a/describe.py +++ b/describe.py @@ -514,8 +514,6 @@ def generate_all_api_documents( artifact_destination_dir (str): relative path where the discovery artifacts should be saved. discovery_uri_template (str): URI template of the API's discovery document. - If this parameter is set, the `uri` parameter is ignored and the uri - will be created from this template. """ api_directory = collections.defaultdict(list) http = build_http() From 1551d5e122e7ef5fa4f8b0e88b2873324d6bb2ca Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 18:06:04 +0000 Subject: [PATCH 03/20] restore behavior --- describe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/describe.py b/describe.py index 06e465bf1ba..45ed459cb7d 100644 --- a/describe.py +++ b/describe.py @@ -413,7 +413,7 @@ def document_api( ) if not uri: - uritemplate.expand( + uri = uritemplate.expand( FLAGS.discovery_uri_template, {"api": name, "apiVersion": version} ) From f8e3a612396845470ec1211f9d885b1842a76b14 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 18:06:54 +0000 Subject: [PATCH 04/20] clean up --- describe.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/describe.py b/describe.py index 45ed459cb7d..3643b1bfde6 100644 --- a/describe.py +++ b/describe.py @@ -412,8 +412,7 @@ def document_api( discovery_uri_template, {"api": name, "apiVersion": version} ) - if not uri: - uri = uritemplate.expand( + uri = uri or uritemplate.expand( FLAGS.discovery_uri_template, {"api": name, "apiVersion": version} ) From 690dd61fa8655111202babbe4d9f954501a1db7b Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 18:09:02 +0000 Subject: [PATCH 05/20] clean up --- describe.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/describe.py b/describe.py index 3643b1bfde6..2f223f5d5eb 100644 --- a/describe.py +++ b/describe.py @@ -406,15 +406,18 @@ def document_api( If this parameter is set, the `uri` parameter is ignored and the uri will be created from this template. """ - # Use the discovery_uri_template to create the uri if provided + # Use the discovery_uri_template to create the uri if provided, + # ignoring the `uri` argument of `document_api` if discovery_uri_template: uri = uritemplate.expand( discovery_uri_template, {"api": name, "apiVersion": version} ) - - uri = uri or uritemplate.expand( - FLAGS.discovery_uri_template, {"api": name, "apiVersion": version} - ) + else: + # Use `uri` argument of `document_api` or + # create the uri from `FLAGS.discovery_uri_template` + uri = uri or uritemplate.expand( + FLAGS.discovery_uri_template, {"api": name, "apiVersion": version} + ) http = build_http() resp, content = http.request(uri) From 355963b791c10231a65221447ca9a536fffc9dd5 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 17 Jul 2024 18:10:02 +0000 Subject: [PATCH 06/20] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- describe.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/describe.py b/describe.py index 45ed459cb7d..4808b1974f0 100644 --- a/describe.py +++ b/describe.py @@ -390,7 +390,12 @@ def document_collection_recursive( def document_api( - name, version, uri, doc_destination_dir, artifact_destination_dir=DISCOVERY_DOC_DIR, discovery_uri_template=None + name, + version, + uri, + doc_destination_dir, + artifact_destination_dir=DISCOVERY_DOC_DIR, + discovery_uri_template=None, ): """Document the given API. From 5236f85a9b81f90acf3839cfaafd48da0714f798 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 17 Jul 2024 18:12:59 +0000 Subject: [PATCH 07/20] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- describe.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/describe.py b/describe.py index 2f223f5d5eb..86c50fdc3e6 100644 --- a/describe.py +++ b/describe.py @@ -390,7 +390,12 @@ def document_collection_recursive( def document_api( - name, version, uri, doc_destination_dir, artifact_destination_dir=DISCOVERY_DOC_DIR, discovery_uri_template=None + name, + version, + uri, + doc_destination_dir, + artifact_destination_dir=DISCOVERY_DOC_DIR, + discovery_uri_template=None, ): """Document the given API. @@ -416,8 +421,8 @@ def document_api( # Use `uri` argument of `document_api` or # create the uri from `FLAGS.discovery_uri_template` uri = uri or uritemplate.expand( - FLAGS.discovery_uri_template, {"api": name, "apiVersion": version} - ) + FLAGS.discovery_uri_template, {"api": name, "apiVersion": version} + ) http = build_http() resp, content = http.request(uri) From c62126ed9cc7418f3eb9d43c5a506c00bf230a74 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 17 Jul 2024 18:14:00 +0000 Subject: [PATCH 08/20] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- describe.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/describe.py b/describe.py index 4b477be4176..86c50fdc3e6 100644 --- a/describe.py +++ b/describe.py @@ -421,8 +421,8 @@ def document_api( # Use `uri` argument of `document_api` or # create the uri from `FLAGS.discovery_uri_template` uri = uri or uritemplate.expand( - FLAGS.discovery_uri_template, {"api": name, "apiVersion": version} - ) + FLAGS.discovery_uri_template, {"api": name, "apiVersion": version} + ) http = build_http() resp, content = http.request(uri) From 3863180415eea21b2d74d4e58e65ccb83ed82cae Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 19:44:30 +0000 Subject: [PATCH 09/20] address review feedback --- describe.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/describe.py b/describe.py index 86c50fdc3e6..07f63d8fc7e 100644 --- a/describe.py +++ b/describe.py @@ -405,9 +405,9 @@ def document_api( uri (str): URI of the API's discovery document doc_destination_dir (str): relative path where the reference documentation should be saved. - artifact_destination_dir (str): relative path where the discovery + artifact_destination_dir (Optional[str]): relative path where the discovery artifacts should be saved. - discovery_uri_template (str): URI template of the API's discovery document. + discovery_uri_template (Optional[str]): URI template of the API's discovery document. If this parameter is set, the `uri` parameter is ignored and the uri will be created from this template. """ @@ -515,12 +515,13 @@ def generate_all_api_documents( """Retrieve discovery artifacts and fetch reference documentations for all apis listed in the public discovery directory. args: - directory_uri (str): uri of the public discovery directory. - doc_destination_dir (str): relative path where the reference + directory_uri (Optional[str]): uri of the public discovery directory. + doc_destination_dir (Optional[str]): relative path where the reference documentation should be saved. - artifact_destination_dir (str): relative path where the discovery + artifact_destination_dir (Optional[str]): relative path where the discovery artifacts should be saved. - discovery_uri_template (str): URI template of the API's discovery document. + discovery_uri_template (Optional[str]): URI template of the API's discovery + document. """ api_directory = collections.defaultdict(list) http = build_http() From 7a35f8c26b0452a150cac1e3b02a82fc6a1bc30b Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 19:47:33 +0000 Subject: [PATCH 10/20] address review feedback --- describe.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/describe.py b/describe.py index 07f63d8fc7e..0972ce89da0 100644 --- a/describe.py +++ b/describe.py @@ -411,18 +411,12 @@ def document_api( If this parameter is set, the `uri` parameter is ignored and the uri will be created from this template. """ - # Use the discovery_uri_template to create the uri if provided, - # ignoring the `uri` argument of `document_api` - if discovery_uri_template: - uri = uritemplate.expand( - discovery_uri_template, {"api": name, "apiVersion": version} - ) - else: - # Use `uri` argument of `document_api` or - # create the uri from `FLAGS.discovery_uri_template` - uri = uri or uritemplate.expand( - FLAGS.discovery_uri_template, {"api": name, "apiVersion": version} - ) + # The order for constructing `uri` is use `discovery_uri_template` if provided, + # then use `uri` argument if provided, then fallback to `FLAGS.discovery_uri_template` + uri = uritemplate.expand( + discovery_uri_template or uri or FLAGS.discovery_uri_template, + {"api": name, "apiVersion": version}, + ) http = build_http() resp, content = http.request(uri) From 78e689956783619aae07761ae71225c2b14f6ec5 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 19:53:38 +0000 Subject: [PATCH 11/20] address review feedback --- describe.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/describe.py b/describe.py index 0972ce89da0..77dbb03ce44 100644 --- a/describe.py +++ b/describe.py @@ -395,7 +395,6 @@ def document_api( uri, doc_destination_dir, artifact_destination_dir=DISCOVERY_DOC_DIR, - discovery_uri_template=None, ): """Document the given API. @@ -407,19 +406,14 @@ def document_api( documentation should be saved. artifact_destination_dir (Optional[str]): relative path where the discovery artifacts should be saved. - discovery_uri_template (Optional[str]): URI template of the API's discovery document. - If this parameter is set, the `uri` parameter is ignored and the uri - will be created from this template. """ - # The order for constructing `uri` is use `discovery_uri_template` if provided, - # then use `uri` argument if provided, then fallback to `FLAGS.discovery_uri_template` - uri = uritemplate.expand( - discovery_uri_template or uri or FLAGS.discovery_uri_template, - {"api": name, "apiVersion": version}, - ) - http = build_http() - resp, content = http.request(uri) + resp, content = http.request( + uri + or uritemplate.expand( + FLAGS.discovery_uri_template, {"api": name, "apiVersion": version} + ) + ) if resp.status == 200: discovery = json.loads(content) @@ -526,7 +520,7 @@ def generate_all_api_documents( document_api( api["name"], api["version"], - api["discoveryRestUrl"], + discovery_uri_template or api["discoveryRestUrl"], doc_destination_dir, artifact_destination_dir, discovery_uri_template, From d1246f32a6a403a0350a9d9353d7d00b207df11d Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 19:54:07 +0000 Subject: [PATCH 12/20] clean up --- describe.py | 1 - 1 file changed, 1 deletion(-) diff --git a/describe.py b/describe.py index 77dbb03ce44..5af23c57b8e 100644 --- a/describe.py +++ b/describe.py @@ -523,7 +523,6 @@ def generate_all_api_documents( discovery_uri_template or api["discoveryRestUrl"], doc_destination_dir, artifact_destination_dir, - discovery_uri_template, ) api_directory[api["name"]].append(api["version"]) From 0daa797eac3b2da8a3408dd040f4978bb5b79702 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 20:01:46 +0000 Subject: [PATCH 13/20] Add comment --- describe.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/describe.py b/describe.py index 5af23c57b8e..44238f88a65 100644 --- a/describe.py +++ b/describe.py @@ -408,6 +408,8 @@ def document_api( artifacts should be saved. """ http = build_http() + # TODO(https://github.com/googleapis/google-api-python-client/issues/2444): + # We shouldn't be referencing FLAGS directly from within function resp, content = http.request( uri or uritemplate.expand( From ef670a14acad8ff16c0ac653ef58288e38bf2011 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 20:12:07 +0000 Subject: [PATCH 14/20] Address review feedback --- describe.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/describe.py b/describe.py index 44238f88a65..fbcb0e514dc 100644 --- a/describe.py +++ b/describe.py @@ -408,14 +408,7 @@ def document_api( artifacts should be saved. """ http = build_http() - # TODO(https://github.com/googleapis/google-api-python-client/issues/2444): - # We shouldn't be referencing FLAGS directly from within function - resp, content = http.request( - uri - or uritemplate.expand( - FLAGS.discovery_uri_template, {"api": name, "apiVersion": version} - ) - ) + resp, content = http.request(uri) if resp.status == 200: discovery = json.loads(content) @@ -519,10 +512,13 @@ def generate_all_api_documents( if resp.status == 200: directory = json.loads(content)["items"] for api in directory: + uri = uritemplate.expand( + discovery_uri_template or FLAGS.discovery_uri_template or api["discoveryRestUrl"], + {"api": api["name"], "apiVersion": api["version"]} + ) document_api( api["name"], api["version"], - discovery_uri_template or api["discoveryRestUrl"], doc_destination_dir, artifact_destination_dir, ) From 43812d07b79cf70f2e9389ad9c2dacc84e3b6e20 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 20:12:45 +0000 Subject: [PATCH 15/20] clean up --- describe.py | 1 + 1 file changed, 1 insertion(+) diff --git a/describe.py b/describe.py index fbcb0e514dc..45189f7338d 100644 --- a/describe.py +++ b/describe.py @@ -519,6 +519,7 @@ def generate_all_api_documents( document_api( api["name"], api["version"], + uri, doc_destination_dir, artifact_destination_dir, ) From 68b3f16ce9763850bc7f9abf6fccee02c7437e73 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 20:20:08 +0000 Subject: [PATCH 16/20] Address review feedback --- describe.py | 8 +++++--- scripts/updatediscoveryartifacts.py | 5 ----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/describe.py b/describe.py index 45189f7338d..8ff59117402 100644 --- a/describe.py +++ b/describe.py @@ -136,13 +136,15 @@ BASE = pathlib.Path(__file__).resolve().parent / "docs" / "dyn" -DIRECTORY_URI = "https://www.googleapis.com/discovery/v1/apis" +# Obtain the discovery index and artifacts from googleapis/discovery-artifact-manager +DIRECTORY_URI = "https://raw.githubusercontent.com/googleapis/discovery-artifact-manager/master/discoveries/index.json" +DISCOVERY_URI_TEMPLATE = "https://raw.githubusercontent.com/googleapis/discovery-artifact-manager/master/discoveries/{api}.{apiVersion}.json" parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( "--discovery_uri_template", - default=DISCOVERY_URI, + default=DISCOVERY_URI_TEMPLATE, help="URI Template for discovery.", ) @@ -513,7 +515,7 @@ def generate_all_api_documents( directory = json.loads(content)["items"] for api in directory: uri = uritemplate.expand( - discovery_uri_template or FLAGS.discovery_uri_template or api["discoveryRestUrl"], + discovery_uri_template or FLAGS.discovery_uri_template, {"api": api["name"], "apiVersion": api["version"]} ) document_api( diff --git a/scripts/updatediscoveryartifacts.py b/scripts/updatediscoveryartifacts.py index 7e5391a2979..fd663480b74 100644 --- a/scripts/updatediscoveryartifacts.py +++ b/scripts/updatediscoveryartifacts.py @@ -23,9 +23,6 @@ import describe SCRIPTS_DIR = pathlib.Path(__file__).parent.resolve() -# Obtain the discovery index and artifacts from googleapis/discovery-artifact-manager -DIRECTORY_URI = "https://raw.githubusercontent.com/googleapis/discovery-artifact-manager/master/discoveries/index.json" -DISCOVERY_URI_TEMPLATE = "https://raw.githubusercontent.com/googleapis/discovery-artifact-manager/master/discoveries/{api}.{apiVersion}.json" DISCOVERY_DOC_DIR = ( SCRIPTS_DIR / ".." / "googleapiclient" / "discovery_cache" / "documents" ) @@ -49,10 +46,8 @@ # Download discovery artifacts and generate documentation describe.generate_all_api_documents( - directory_uri=DIRECTORY_URI, doc_destination_dir=REFERENCE_DOC_DIR, artifact_destination_dir=DISCOVERY_DOC_DIR, - discovery_uri_template=DISCOVERY_URI_TEMPLATE, ) # Get a list of files changed using `git diff` From 32c1e62bd9696289062eae2272b039fc44340093 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 20:23:33 +0000 Subject: [PATCH 17/20] Address review feedback --- describe.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/describe.py b/describe.py index 8ff59117402..581f33e1335 100644 --- a/describe.py +++ b/describe.py @@ -515,7 +515,7 @@ def generate_all_api_documents( directory = json.loads(content)["items"] for api in directory: uri = uritemplate.expand( - discovery_uri_template or FLAGS.discovery_uri_template, + discovery_uri_template, {"api": api["name"], "apiVersion": api["version"]} ) document_api( @@ -563,4 +563,5 @@ def generate_all_api_documents( generate_all_api_documents( directory_uri=FLAGS.directory_uri, doc_destination_dir=FLAGS.dest, + discovery_uri_template=FLAGS.discovery_uri_template, ) From 4d43fe626891ae3477b13520d42873edc7156fa5 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 20:26:02 +0000 Subject: [PATCH 18/20] clean up --- describe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/describe.py b/describe.py index 581f33e1335..af8454ea7c3 100644 --- a/describe.py +++ b/describe.py @@ -515,7 +515,7 @@ def generate_all_api_documents( directory = json.loads(content)["items"] for api in directory: uri = uritemplate.expand( - discovery_uri_template, + discovery_uri_template or api["discoveryRestUrl"], {"api": api["name"], "apiVersion": api["version"]} ) document_api( From 277bb02e100c0dd78bf960a4f971a8ab30af5911 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 17 Jul 2024 20:29:49 +0000 Subject: [PATCH 19/20] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- describe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/describe.py b/describe.py index af8454ea7c3..8f4321113d2 100644 --- a/describe.py +++ b/describe.py @@ -516,7 +516,7 @@ def generate_all_api_documents( for api in directory: uri = uritemplate.expand( discovery_uri_template or api["discoveryRestUrl"], - {"api": api["name"], "apiVersion": api["version"]} + {"api": api["name"], "apiVersion": api["version"]}, ) document_api( api["name"], From 347edc701ec9cc94ae11e23d66b7524643f9c66c Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Jul 2024 20:30:08 +0000 Subject: [PATCH 20/20] clean up --- describe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/describe.py b/describe.py index 8f4321113d2..3236cafb869 100644 --- a/describe.py +++ b/describe.py @@ -495,7 +495,7 @@ def generate_all_api_documents( directory_uri=DIRECTORY_URI, doc_destination_dir=BASE, artifact_destination_dir=DISCOVERY_DOC_DIR, - discovery_uri_template=None, + discovery_uri_template=DISCOVERY_URI_TEMPLATE, ): """Retrieve discovery artifacts and fetch reference documentations for all apis listed in the public discovery directory.