Skip to content
Snippets Groups Projects
Commit eae25a8e authored by Tom Käsler's avatar Tom Käsler
Browse files

replace com.wordnik.swagger with io.swagger

remove spingfox for ApiIgnore direction
use swagger-maven-plugin to generate swagger.json before compiling rather than
 dynamically generate it on request
parent 3d0e0e5e
Branches
Tags
1 merge request!10Interactive API documentation
Showing
with 40 additions and 114 deletions
......@@ -48,7 +48,6 @@ import de.thm.arsnova.ImageUtils;
@EnableWebMvc
@Configuration
@EnableCaching
@Import(SwaggerConfiguration.class)
public class ExtraConfig extends WebMvcConfigurerAdapter {
@Autowired
......@@ -124,13 +123,4 @@ public class ExtraConfig extends WebMvcConfigurerAdapter {
public ImageUtils imageUtils() {
return new ImageUtils();
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
/*
* This file is part of ARSnova Backend.
* Copyright (C) 2012-2015 The ARSnova Team
*
* ARSnova Backend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ARSnova Backend is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.thm.arsnova.config;
import org.springframework.context.annotation.Bean;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
public class SwaggerConfiguration {
@Bean
public Docket customImplementation() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(getApiInfo());
}
private ApiInfo getApiInfo() {
return new ApiInfo(
"ARSnova Backend",
"This is the REST API documentation of the ARSnova Backend, created with the SpringFox Framework",
"1.0",
"ARSnova API terms of service",
"arsnova@thm.de",
"GNU General Public License",
"http://www.gnu.org/licenses/");
}
}
......@@ -31,11 +31,11 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import com.wordnik.swagger.annotations.ApiResponse;
import com.wordnik.swagger.annotations.ApiResponses;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import de.thm.arsnova.entities.InterposedReadingCount;
import de.thm.arsnova.entities.transport.InterposedQuestion;
......
......@@ -21,8 +21,6 @@ import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import springfox.documentation.annotations.ApiIgnore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
......@@ -37,7 +35,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
* in case the backend application is deployed as root context.
*/
@Controller
@ApiIgnore
@RequestMapping({"/configuration", "/arsnova-config"})
public class ConfigurationController extends AbstractController {
@Value("${security.guest.enabled}")
......
......@@ -30,11 +30,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import com.wordnik.swagger.annotations.ApiResponse;
import com.wordnik.swagger.annotations.ApiResponses;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import de.thm.arsnova.connector.client.ConnectorClient;
import de.thm.arsnova.connector.model.Course;
......
......@@ -28,10 +28,10 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiResponse;
import com.wordnik.swagger.annotations.ApiResponses;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import de.thm.arsnova.entities.Feedback;
import de.thm.arsnova.entities.User;
......
......@@ -35,10 +35,10 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiResponse;
import com.wordnik.swagger.annotations.ApiResponses;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import de.thm.arsnova.PaginationListDecorator;
import de.thm.arsnova.entities.Answer;
......
......@@ -26,8 +26,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
import de.thm.arsnova.services.IQuestionService;
import de.thm.arsnova.web.DeprecatedApi;
......@@ -35,7 +33,6 @@ import de.thm.arsnova.web.DeprecatedApi;
* This controller forwards requests from deprecated URLs to their new controller, where the requests are handled.
*/
@Controller
@ApiIgnore
public class LegacyController extends AbstractController {
public static final Logger LOGGER = LoggerFactory.getLogger(LegacyController.class);
......
......@@ -57,8 +57,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.view.RedirectView;
import springfox.documentation.annotations.ApiIgnore;
import de.thm.arsnova.entities.ServiceDescription;
import de.thm.arsnova.entities.Session;
import de.thm.arsnova.entities.User;
......@@ -70,7 +68,6 @@ import de.thm.arsnova.services.UserSessionService;
* Handles authentication specific requests.
*/
@Controller
@ApiIgnore
public class LoginController extends AbstractController {
private static final int MAX_USERNAME_LENGTH = 15;
......
......@@ -30,8 +30,6 @@ import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import springfox.documentation.annotations.ApiIgnore;
import de.thm.arsnova.exceptions.BadRequestException;
import de.thm.arsnova.exceptions.ForbiddenException;
import de.thm.arsnova.exceptions.NoContentException;
......@@ -45,7 +43,6 @@ import de.thm.arsnova.exceptions.PayloadTooLargeException;
* Translates security/authentication related exceptions into HTTP status codes.
*/
@ControllerAdvice
@ApiIgnore
public class SecurityExceptionControllerAdvice {
@ResponseStatus(HttpStatus.NOT_FOUND)
......
......@@ -36,11 +36,11 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import com.wordnik.swagger.annotations.ApiResponse;
import com.wordnik.swagger.annotations.ApiResponses;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import de.thm.arsnova.connector.model.Course;
import de.thm.arsnova.entities.Session;
......
......@@ -32,11 +32,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import com.wordnik.swagger.annotations.ApiResponse;
import com.wordnik.swagger.annotations.ApiResponses;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import de.thm.arsnova.entities.User;
import de.thm.arsnova.services.IUserService;
......
......@@ -22,8 +22,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import de.thm.arsnova.entities.Statistics;
import de.thm.arsnova.services.IStatisticsService;
......
......@@ -31,8 +31,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import springfox.documentation.annotations.ApiIgnore;
import de.thm.arsnova.entities.DbUser;
import de.thm.arsnova.services.IUserService;
import de.thm.arsnova.services.UserSessionService;
......@@ -41,7 +39,6 @@ import de.thm.arsnova.services.UserSessionService;
* Handles requests related to ARSnova's own user registration and login process.
*/
@Controller
@ApiIgnore
@RequestMapping("/user")
public class UserController extends AbstractController {
@Value("${security.guest.enabled}")
......
......@@ -40,8 +40,6 @@ import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.view.RedirectView;
import springfox.documentation.annotations.ApiIgnore;
import de.thm.arsnova.exceptions.BadRequestException;
import de.thm.arsnova.exceptions.NoContentException;
......@@ -49,7 +47,6 @@ import de.thm.arsnova.exceptions.NoContentException;
* Default controller that handles requests which have not set a path.
*/
@Controller
@ApiIgnore
public class WelcomeController extends AbstractController {
@Value("${mobile.path}")
......
......@@ -18,8 +18,8 @@
package de.thm.arsnova.entities;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.wordnik.swagger.annotations.ApiModel;
import com.wordnik.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Both a regular (single choice, evaluation, etc.) as well as a freetext answer.
......
......@@ -18,8 +18,8 @@
package de.thm.arsnova.entities;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.wordnik.swagger.annotations.ApiModel;
import com.wordnik.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* A question the user is asking the teacher. Also known as feedback or audience question.
......
......@@ -17,8 +17,8 @@
*/
package de.thm.arsnova.entities;
import com.wordnik.swagger.annotations.ApiModel;
import com.wordnik.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Wrapper class for counting read and unread interposed questions for a session or a single user.
......
......@@ -17,8 +17,8 @@
*/
package de.thm.arsnova.entities;
import com.wordnik.swagger.annotations.ApiModel;
import com.wordnik.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* A session's settings regarding the calculation of the learning progress.
*/
......
......@@ -17,8 +17,8 @@
*/
package de.thm.arsnova.entities;
import com.wordnik.swagger.annotations.ApiModel;
import com.wordnik.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* This class represents an answer option of a question.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment