diff --git a/chat-client-java-lib/pom.xml b/chat-client-java-lib/pom.xml index dcc994c..a0bac7e 100644 --- a/chat-client-java-lib/pom.xml +++ b/chat-client-java-lib/pom.xml @@ -8,12 +8,11 @@ cz.muni.chat chat-service-parent - 1.0.0 + 1.1.0 chat-client-java-lib - 1.0.0 jar Chat client library in Java Client library generated using OpenAPI Generator diff --git a/chat-client-java/pom.xml b/chat-client-java/pom.xml index c8d1e1c..397fa86 100644 --- a/chat-client-java/pom.xml +++ b/chat-client-java/pom.xml @@ -8,12 +8,11 @@ cz.muni.chat chat-service-parent - 1.0.0 + 1.1.0 chat-client-java - 1.0.0 jar Executable chat client in Java Command-line client for Chat service diff --git a/chat-server/pom.xml b/chat-server/pom.xml index a9dd951..f89d997 100644 --- a/chat-server/pom.xml +++ b/chat-server/pom.xml @@ -8,7 +8,7 @@ cz.muni.chat chat-service-parent - 1.0.0 + 1.1.0 diff --git a/chat-server/src/main/java/cz/muni/chat/server/ChatApplication.java b/chat-server/src/main/java/cz/muni/chat/server/ChatApplication.java index f1c3bc6..ed63fe9 100644 --- a/chat-server/src/main/java/cz/muni/chat/server/ChatApplication.java +++ b/chat-server/src/main/java/cz/muni/chat/server/ChatApplication.java @@ -8,7 +8,7 @@ * * @author Martin Kuba makub@ics.muni.cz */ -@SpringBootApplication // this annotation marks this class as runnable Spring Boot app +@SpringBootApplication // this annotation marks this class as a runnable Spring Boot app public class ChatApplication { public static void main(String[] args) { diff --git a/chat-server/src/main/java/cz/muni/chat/server/facade/BackgroundColor.java b/chat-server/src/main/java/cz/muni/chat/server/facade/BackgroundColor.java index 085476f..ba90229 100644 --- a/chat-server/src/main/java/cz/muni/chat/server/facade/BackgroundColor.java +++ b/chat-server/src/main/java/cz/muni/chat/server/facade/BackgroundColor.java @@ -8,6 +8,7 @@ /** * Enum for background color. + * String values are different from enum identifiers, i.e. "#ffe4c4" for BISQUE. */ @Schema( name = "BackgroundColorEnum", diff --git a/chat-server/src/main/java/cz/muni/chat/server/facade/NewChatMessageRequest.java b/chat-server/src/main/java/cz/muni/chat/server/facade/NewChatMessageRequest.java index b4604d2..45594e4 100644 --- a/chat-server/src/main/java/cz/muni/chat/server/facade/NewChatMessageRequest.java +++ b/chat-server/src/main/java/cz/muni/chat/server/facade/NewChatMessageRequest.java @@ -12,6 +12,7 @@ See [What is the maximum length of a URL in different browsers?](https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers) """ ) +@SuppressWarnings("unused") public class NewChatMessageRequest { @NotBlank diff --git a/chat-server/src/main/java/cz/muni/chat/server/rest/ApiConfig.java b/chat-server/src/main/java/cz/muni/chat/server/rest/ApiConfig.java index c031a6e..6f95690 100644 --- a/chat-server/src/main/java/cz/muni/chat/server/rest/ApiConfig.java +++ b/chat-server/src/main/java/cz/muni/chat/server/rest/ApiConfig.java @@ -28,6 +28,7 @@ public void onApplicationEvent(final ServletWebServerInitializedEvent event) { * Adds shared definition to #/components/responses * that cannot be added using annotations. */ + @SuppressWarnings("Convert2Lambda") @Bean public OpenApiCustomizer openAPICustomizer() { return new OpenApiCustomizer() { diff --git a/chat-server/src/main/java/cz/muni/chat/server/rest/ChatRestController.java b/chat-server/src/main/java/cz/muni/chat/server/rest/ChatRestController.java index 59b4192..8a390c4 100644 --- a/chat-server/src/main/java/cz/muni/chat/server/rest/ChatRestController.java +++ b/chat-server/src/main/java/cz/muni/chat/server/rest/ChatRestController.java @@ -51,8 +51,22 @@ // see javadoc at https://javadoc.io/doc/io.swagger.core.v3/swagger-annotations/latest/index.html // see docs at https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations info = @Info(title = "Example Chat Service", - version = "1.0", - description = "Simple Spring Boot service for chatting", + version = "1.1", + description = """ + Simple service for chatting. The API has operations for: + - getting all messages + - creating a new message + - getting messages in pages, i.e. last 20 messages or previous 20 messages + - getting a specific message by its id + + The description of the API in OpenAPI format is generated by + the tool [SpringDoc v2](https://springdoc.org/v2/) from annotated Java classes, + mainly the controller class + [ChatRestController](https://github.com/martin-kuba/muni-chat-service/blob/main/chat-server/src/main/java/cz/muni/chat/server/rest/ChatRestController.java) + and the DTO classes in + [cz.muni.chat.server.facade](https://github.com/martin-kuba/muni-chat-service/tree/main/chat-server/src/main/java/cz/muni/chat/server/facade) + package. + """, contact = @Contact(name = "Martin Kuba", email = "makub@ics.muni.cz", url = "https://www.muni.cz/lide/3988-martin-kuba"), license = @License(name = "Apache 2.0", url = "https://www.apache.org/licenses/LICENSE-2.0.html") ), diff --git a/chat-server/src/main/java/cz/muni/chat/server/service/ChatServiceImpl.java b/chat-server/src/main/java/cz/muni/chat/server/service/ChatServiceImpl.java index 18912d2..a3c692e 100644 --- a/chat-server/src/main/java/cz/muni/chat/server/service/ChatServiceImpl.java +++ b/chat-server/src/main/java/cz/muni/chat/server/service/ChatServiceImpl.java @@ -7,7 +7,6 @@ import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; -import org.springframework.util.comparator.Comparators; import java.time.ZonedDateTime; import java.util.List; diff --git a/chat-server/src/main/java/cz/muni/chat/server/ui/ChatUIController.java b/chat-server/src/main/java/cz/muni/chat/server/ui/ChatUIController.java index afc5472..ecc9787 100644 --- a/chat-server/src/main/java/cz/muni/chat/server/ui/ChatUIController.java +++ b/chat-server/src/main/java/cz/muni/chat/server/ui/ChatUIController.java @@ -15,6 +15,9 @@ import static org.apache.commons.text.StringEscapeUtils.escapeHtml4; +/** + * Simple Spring MVC Controller generating HTML page on URL /chat displaying all chat messages. + */ @Controller public class ChatUIController { diff --git a/chat-server/src/main/resources/static/index.html b/chat-server/src/main/resources/static/index.html index 384981a..8ae97f1 100644 --- a/chat-server/src/main/resources/static/index.html +++ b/chat-server/src/main/resources/static/index.html @@ -37,7 +37,7 @@

OpenAPI Description

  • in JSON at /openapi
  • in YAML at /openapi.yaml
  • -

    Open the OpenAPI description in Swagger UI and try to call the service.

    +

    Open the OpenAPI description in Swagger UI and try to call the service.

    \ No newline at end of file diff --git a/openapi.yaml b/openapi.yaml index 103bb21..8601430 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -1,7 +1,20 @@ openapi: 3.0.1 info: title: Example Chat Service - description: Simple Spring Boot service for chatting + description: | + Simple service for chatting. The API has operations for: + - getting all messages + - creating a new message + - getting messages in pages, i.e. last 20 messages or previous 20 messages + - getting a specific message by its id + + The description of the API in OpenAPI format is generated by + the tool [SpringDoc v2](https://springdoc.org/v2/) from annotated Java classes, + mainly the controller class + [ChatRestController](https://github.com/martin-kuba/muni-chat-service/blob/main/chat-server/src/main/java/cz/muni/chat/server/rest/ChatRestController.java) + and the DTO classes in + [cz.muni.chat.server.facade](https://github.com/martin-kuba/muni-chat-service/tree/main/chat-server/src/main/java/cz/muni/chat/server/facade) + package. contact: name: Martin Kuba url: https://www.muni.cz/lide/3988-martin-kuba @@ -9,7 +22,7 @@ info: license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html - version: "1.0" + version: "1.1" servers: - url: "{scheme}://{server}:{port}" description: my server diff --git a/pom.xml b/pom.xml index 3c17066..36f62ac 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 cz.muni.chat chat-service-parent - 1.0.0 + 1.1.0 pom Chat service parent project