Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Commit 49d17fc

Browse files
kaldeberttangiel
kaldebert
authored andcommitted
Add documentation link in discovery files
1 parent 1bb02fd commit 49d17fc

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

endpoints-framework/src/main/java/com/google/api/server/spi/discovery/DiscoveryGenerator.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ private RestDescription writeApi(ApiKey apiKey, Iterable<ApiConfig> apiConfigs,
154154
if (config.getTitle() != null) {
155155
doc.setTitle(config.getTitle());
156156
}
157+
if (config.getDocumentationLink() != null) {
158+
doc.setDocumentationLink(config.getDocumentationLink());
159+
}
157160
if (config.getNamespaceConfig() != null) {
158161
ApiNamespaceConfig namespaceConfig = config.getNamespaceConfig();
159162
if (!Strings.isEmptyOrWhitespace(namespaceConfig.getOwnerName())) {
@@ -392,7 +395,8 @@ private DirectoryList generateDirectory(Map<ApiKey, RestDescription> discoveryDo
392395
.setName(doc.getName())
393396
.setPreferred(preferred.contains(entry.getKey()))
394397
.setTitle(doc.getTitle())
395-
.setVersion(doc.getVersion()));
398+
.setVersion(doc.getVersion())
399+
.setDocumentationLink(doc.getDocumentationLink()));
396400
}
397401
return directory.setItems(items);
398402
}

endpoints-framework/src/test/resources/com/google/api/server/spi/discovery/foo_endpoint.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"batchPath": "batch",
1414
"description": "Just Foo Things",
1515
"discoveryVersion": "v1",
16+
"documentationLink": "https://example.com",
1617
"icons": {
1718
"x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png",
1819
"x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png"

endpoints-framework/src/test/resources/com/google/api/server/spi/discovery/foo_endpoint_default_context.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"batchPath": "batch",
1414
"description": "Just Foo Things",
1515
"discoveryVersion": "v1",
16+
"documentationLink": "https://example.com",
1617
"icons": {
1718
"x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png",
1819
"x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png"

endpoints-framework/src/test/resources/com/google/api/server/spi/discovery/foo_endpoint_localhost.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"batchPath": "batch",
1414
"description": "Just Foo Things",
1515
"discoveryVersion": "v1",
16+
"documentationLink": "https://example.com",
1617
"icons": {
1718
"x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png",
1819
"x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png"

test-utils/src/main/java/com/google/api/server/spi/testing/FooEndpoint.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
version = "v1",
2828
audiences = {"audience"},
2929
title = "The Foo API",
30-
description = "Just Foo Things")
30+
description = "Just Foo Things",
31+
documentationLink = "https://example.com")
3132
public class FooEndpoint {
3233
@ApiMethod(name = "foo.create", description = "create desc", path = "foos/{id}",
3334
httpMethod = HttpMethod.PUT)

0 commit comments

Comments
 (0)