package com.linkedin.pinot.controller.api.restlet.resources;

import com.linkedin.pinot.common.Utils;
import com.linkedin.pinot.controller.api.swagger.HttpVerb;
import com.linkedin.pinot.controller.api.swagger.Paths;
import com.linkedin.pinot.controller.api.swagger.Summary;
import com.linkedin.pinot.controller.api.swagger.Tags;
import org.json.JSONObject;
import org.restlet.data.MediaType;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.Get;


/**
 * API endpoint that returns the versions of Pinot components.
 */
public class PinotVersionRestletResource extends PinotRestletResourceBase {
  @Override
  @Get
  public Representation get() {
    return buildVersionResponse();
  }

  @HttpVerb("get")
  @Summary("Obtains the version number of the Pinot components")
  @Tags({ "version" })
  @Paths({ "/version" })
  private Representation buildVersionResponse() {
    JSONObject jsonObject = new JSONObject(Utils.getComponentVersions());
    return new StringRepresentation(jsonObject.toString(), MediaType.APPLICATION_ALL_JSON);
  }
}

@@ -1106,12 +1106,8 @@
 ION_
-ALL_
 JSON

Fix version endpoint returning a Content-Type of application/xml instead of application/json when client specifies Accept-Content-Type: application/xml