aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-09-12 15:29:37 +0300
committerGravatar Vitaly Takmazov2018-09-12 15:29:37 +0300
commitddf8c3c0f07c0ca2fa6444c4511b61fc9a5c496c (patch)
tree486cc99823acb4159a3fd29bbc566dd69d3bdace /juick-server/src/main
parente97801561c497021a03317090b82d3c2568b1da7 (diff)
static swagger docs
Diffstat (limited to 'juick-server/src/main')
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Index.java7
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Users.java3
-rw-r--r--juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java21
-rw-r--r--juick-server/src/main/java/com/juick/server/xmpp/XMPPStatusPage.java2
4 files changed, 6 insertions, 27 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/Index.java b/juick-server/src/main/java/com/juick/server/api/Index.java
index 947ac920c..56f01370c 100644
--- a/juick-server/src/main/java/com/juick/server/api/Index.java
+++ b/juick-server/src/main/java/com/juick/server/api/Index.java
@@ -19,8 +19,6 @@ package com.juick.server.api;
import com.juick.Status;
import com.juick.server.WebsocketManager;
-import com.juick.server.XMPPServer;
-import com.juick.server.xmpp.helpers.XMPPStatus;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -28,27 +26,26 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
-import rocks.xmpp.addr.Jid;
import springfox.documentation.annotations.ApiIgnore;
import javax.inject.Inject;
import java.net.URI;
-import java.util.stream.Collectors;
/**
* Created by vitalyster on 25.07.2016.
*/
-@ApiIgnore
@RestController
public class Index {
@Inject
private WebsocketManager wsHandler;
+ @ApiIgnore
@RequestMapping(value = { "/api/", "/ws/" }, method = RequestMethod.GET, headers = "Connection!=Upgrade")
public ResponseEntity<Void> description() {
URI redirectUri = ServletUriComponentsBuilder.fromCurrentRequestUri().path("/swagger-ui.html").build().toUri();
return ResponseEntity.status(HttpStatus.MOVED_PERMANENTLY).location(redirectUri).build();
}
+ @ApiIgnore
@RequestMapping(value = "/api/status", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE, headers = "Connection!=Upgrade")
public Status status() {
diff --git a/juick-server/src/main/java/com/juick/server/api/Users.java b/juick-server/src/main/java/com/juick/server/api/Users.java
index 7f29a3271..de5c05c2f 100644
--- a/juick-server/src/main/java/com/juick/server/api/Users.java
+++ b/juick-server/src/main/java/com/juick/server/api/Users.java
@@ -28,7 +28,6 @@ import com.juick.service.MessagesService;
import com.juick.service.UserService;
import com.juick.server.util.UserUtils;
import com.juick.server.util.WebUtils;
-import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@@ -51,7 +50,6 @@ public class Users {
@Inject
private EmailService emailService;
- @ApiOperation(value = "This returns user token", notes = "Pass login and password using HTTP Basic")
@RequestMapping(value = "/api/auth", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public String getAuthToken() {
return userService.getHashByUID(UserUtils.getCurrentUser().getUid());
@@ -143,7 +141,6 @@ public class Users {
throw new HttpNotFoundException();
}
- @ApiOperation(value = "This returns detailed user info")
@GetMapping("/api/info/{uname}")
public UserInfo getUserInfo(@PathVariable String uname) {
User user = userService.getUserByName(uname);
diff --git a/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java b/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java
index 19718abd3..619aeff85 100644
--- a/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java
+++ b/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java
@@ -17,7 +17,6 @@
package com.juick.server.configuration;
-import com.google.common.base.Predicates;
import com.juick.server.WebsocketManager;
import com.juick.server.api.rss.MessagesView;
import com.juick.server.api.rss.RepliesView;
@@ -25,7 +24,8 @@ import com.juick.server.xmpp.JidConverter;
import com.juick.server.xmpp.iq.MessageQuery;
import com.juick.server.xmpp.s2s.BasicXmppSession;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.*;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.convert.ConversionService;
import org.springframework.format.support.DefaultFormattingConversionService;
@@ -42,38 +42,21 @@ import org.springframework.web.socket.server.standard.ServletServerContainerFact
import rocks.xmpp.core.session.Extension;
import rocks.xmpp.core.session.XmppSessionConfiguration;
import rocks.xmpp.core.session.debug.LogbackDebugger;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
import javax.annotation.Nonnull;
import javax.inject.Inject;
import java.time.Duration;
-import java.util.Collections;
/**
* Created by aalexeev on 11/12/16.
*/
@Configuration
@EnableAsync
-@EnableSwagger2
@EnableScheduling
@EnableWebSocket
public class ApiAppConfiguration implements WebMvcConfigurer, WebSocketConfigurer {
@Inject
private WebsocketManager websocketManager;
- @Bean
- public Docket api() {
- return new Docket(DocumentationType.SWAGGER_2)
- .select()
- .apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.boot")))
- .paths(PathSelectors.any()).build().apiInfo(new ApiInfo("Juick API", "Juick REST API Documentation",
- "2.0", "https://juick.com/help/tos", null,
- "AGPLv3", "https://www.gnu.org/licenses/agpl-3.0.html", Collections.emptyList()));
- }
@Override
public void registerWebSocketHandlers(@Nonnull WebSocketHandlerRegistry registry) {
diff --git a/juick-server/src/main/java/com/juick/server/xmpp/XMPPStatusPage.java b/juick-server/src/main/java/com/juick/server/xmpp/XMPPStatusPage.java
index 90c8fe596..231696ec7 100644
--- a/juick-server/src/main/java/com/juick/server/xmpp/XMPPStatusPage.java
+++ b/juick-server/src/main/java/com/juick/server/xmpp/XMPPStatusPage.java
@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import rocks.xmpp.addr.Jid;
+import springfox.documentation.annotations.ApiIgnore;
import javax.inject.Inject;
import java.util.stream.Collectors;
@@ -17,6 +18,7 @@ import java.util.stream.Collectors;
public class XMPPStatusPage {
@Inject
private XMPPServer xmpp;
+ @ApiIgnore
@RequestMapping(method = RequestMethod.GET, value = "/api/xmpp-status", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public XMPPStatus xmppStatus() {
XMPPStatus status = new XMPPStatus();