Skip to content

Commit

Permalink
chore(server): update swagger info for default server profile (#2423)
Browse files Browse the repository at this point in the history
  • Loading branch information
SunnyBoy-WYH authored Jan 28, 2024
1 parent b980df8 commit 1d4532c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
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;
Expand All @@ -55,14 +57,15 @@ 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;

@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;
Expand All @@ -73,6 +76,7 @@ public String getProfile(@Context Application application) {
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)) {
Expand Down

0 comments on commit 1d4532c

Please sign in to comment.