@GetMapping(value = "/swagger.yml", produces = "text/yaml")
  public String swagger(Model model, HttpServletResponse response) {
    response.setContentType("text/yaml");
    response.setCharacterEncoding("UTF-8");
    final UriComponents uriComponents =
        ServletUriComponentsBuilder.fromCurrentContextPath().build();
    model.addAttribute("scheme", uriComponents.getScheme());
    String host = uriComponents.getHost();
    if (uriComponents.getPort() >= 0) {
      host += ":" + uriComponents.getPort();
    }
    model.addAttribute("host", host);
    model.addAttribute(
        "entityTypes",
        metaDataService
            .getEntityTypes()
            .filter(e -> !e.isAbstract())
            .map(EntityType::getId)
            .sorted()
            .collect(toList()));
    model.addAttribute("attributeTypes", AttributeType.getOptionsLowercase());
    model.addAttribute("languageCodes", getLanguageCodes().collect(toList()));
    return "view-swagger";
  }
@ GetMapping ( value = "/swagger.yml" , produces = "text/yaml" ) public String swagger ( Model model , HttpServletResponse response ) { response . setContentType ( "text/yaml" ) ; response . setCharacterEncoding ( "UTF-8" ) ; final UriComponents uriComponents = ServletUriComponentsBuilder . fromCurrentContextPath ( ) . build ( ) ; model . addAttribute ( "scheme" , uriComponents . getScheme ( ) ) ; String host = uriComponents . getHost ( ) ; if ( uriComponents . getPort ( ) >= 0 ) { host += ":" + uriComponents . getPort ( ) ; } model . addAttribute ( "host" , host ) ; model . addAttribute ( "entityTypes" , metaDataService . getEntityTypes ( ) . filter ( e -> ! e . isAbstract ( ) ) . map ( EntityType :: getId ) . sorted ( ) . collect ( toList ( ) ) ) ; model . addAttribute ( "attributeTypes" , AttributeType . getOptionsLowercase ( ) ) ; model . addAttribute ( "languageCodes" , getLanguageCodes ( ) . collect ( toList ( ) ) ) ; return "view-swagger" ; }
Serves the Swagger description of the REST API. As host, fills in the host where the controller
lives. As options for the entity names, contains only those entity names that the user can
actually see.