-
Notifications
You must be signed in to change notification settings - Fork 2.5k
build: fetch discovery artifacts from discovery-artifact-manager #2443
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
Changes from 2 commits
69ecec8
1f9d58f
1551d5e
f8e3a61
690dd61
355963b
1502642
5236f85
6f41acb
c62126e
96c4a9c
3863180
7a35f8c
78e6899
d1246f3
0daa797
ef670a1
43812d0
68b3f16
32c1e62
4d43fe6
277bb02
347edc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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,7 @@ 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. | ||
ohmayr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| """ | ||
| api_directory = collections.defaultdict(list) | ||
| http = build_http() | ||
|
|
@@ -516,6 +527,7 @@ def generate_all_api_documents( | |
| api["discoveryRestUrl"], | ||
| doc_destination_dir, | ||
| artifact_destination_dir, | ||
| discovery_uri_template, | ||
|
||
| ) | ||
| api_directory[api["name"]].append(api["version"]) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.