This is an automated email from the ASF dual-hosted git repository.
vgalaxies pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git
The following commit(s) were added to refs/heads/master by this push:
new 1d4532cd6 chore(server): update swagger info for default server
profile (#2423)
1d4532cd6 is described below
commit 1d4532cd62f9b10e2ef8648047107ae0fd5ca808
Author: SunnyBoy-WYH <[email protected]>
AuthorDate: Sun Jan 28 14:03:38 2024 +0800
chore(server): update swagger info for default server profile (#2423)
---
.../src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git
a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java
b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java
index c28b4878b..5ba53792a 100644
---
a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java
+++
b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java
@@ -34,6 +34,8 @@ import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;
import org.apache.commons.lang3.StringUtils;
+import org.apache.hugegraph.config.HugeConfig;
+import org.apache.hugegraph.config.ServerOptions;
import org.apache.tinkerpop.shaded.jackson.annotation.JsonProperty;
import org.glassfish.jersey.model.Parameter.Source;
import org.glassfish.jersey.server.model.Parameter;
@@ -55,6 +57,7 @@ public class ProfileAPI {
private static final String SERVICE = "hugegraph";
private static final String DOC = "https://hugegraph.apache.org/docs/";
private static final String API_DOC = DOC + "clients/";
+ private static final String SWAGGER_UI = "/swagger-ui/index.html";
private static String SERVER_PROFILES = null;
private static String API_PROFILES = null;
@@ -62,7 +65,7 @@ public class ProfileAPI {
@GET
@Timed
@Produces(MediaType.APPLICATION_JSON)
- public String getProfile(@Context Application application) {
+ public String getProfile(@Context HugeConfig conf, @Context Application
application) {
// May init multi times by multi threads, but no effect on the results
if (SERVER_PROFILES != null) {
return SERVER_PROFILES;
@@ -73,6 +76,7 @@ public class ProfileAPI {
profiles.put("version", CoreVersion.VERSION.toString());
profiles.put("doc", DOC);
profiles.put("api_doc", API_DOC);
+ profiles.put("swagger_ui", conf.get(ServerOptions.REST_SERVER_URL) +
SWAGGER_UI);
Set<String> apis = new TreeSet<>();
for (Class<?> clazz : application.getClasses()) {
if (!isAnnotatedPathClass(clazz)) {