<commit_before>package uk.ac.wellcome.platform.api.controllers

import com.twitter.inject.annotations.Flag
import com.twitter.finagle.http.Request
import com.twitter.finatra.http.Controller

import io.swagger.util.Json
import io.swagger.models.{Info, Scheme}

import javax.inject.{Inject, Singleton}

import uk.ac.wellcome.platform.api.ApiSwagger

@Singleton
class SwaggerController @Inject()(
  @Flag("api.prefix") apiPrefix: String,
  @Flag("api.version") apiVersion: String
) extends Controller {

  prefix(apiPrefix) {

    get("/swagger.json") { request: Request =>
      ApiSwagger.info(
        new Info()
          .description("Search our collections")
          .version(apiVersion)
          .title("Catalogue"))
      ApiSwagger.scheme(Scheme.HTTPS)
      ApiSwagger.host(request.host.getOrElse("api.wellcomecollection.org"))
      ApiSwagger.basePath(apiPrefix)<commit_msg>Adds hard coded host and scheme as other API endoints<commit_after>package uk.ac.wellcome.platform.api.controllers

import com.twitter.inject.annotations.Flag
import com.twitter.finagle.http.Request
import com.twitter.finatra.http.Controller

import io.swagger.util.Json
import io.swagger.models.{Info, Scheme}

import javax.inject.{Inject, Singleton}

import uk.ac.wellcome.platform.api.ApiSwagger

@Singleton
class SwaggerController @Inject()(
  @Flag("api.scheme") apiScheme: String,
  @Flag("api.prefix") apiPrefix: String,
  @Flag("api.version") apiVersion: String,
  @Flag("api.host") apiHost: String
) extends Controller {


  val scheme = apiScheme match {
    case "https" => Scheme.HTTPS
    case _ => Scheme.HTTP
  }

  prefix(apiPrefix) {

    get("/swagger.json") { request: Request =>
      ApiSwagger.info(
        new Info()
          .description("Search our collections")
          .version(apiVersion)
          .title("Catalogue"))
      ApiSwagger.scheme(scheme)
      ApiSwagger.host(apiHost)
      ApiSwagger.basePath(apiPrefix)
{'fraction_non_alphanumeric': 0.12287041817243159, 'fraction_numerical': 0.0, 'mean_word_length': 3.893939393939394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '986207', 'n_tokens_mistral': 604, 'n_tokens_neox': 594, 'n_words': 113}