Skip to content

Commit 17addb9

Browse files
committed
feat: Add Swagger integration for endpoint API documentation
1 parent f294f16 commit 17addb9

File tree

6 files changed

+33
-3
lines changed

6 files changed

+33
-3
lines changed

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@
8080
<artifactId>java-jwt</artifactId>
8181
<version>4.4.0</version>
8282
</dependency>
83+
<dependency>
84+
<groupId>org.springdoc</groupId>
85+
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
86+
<version>2.8.6</version>
87+
</dependency>
8388
</dependencies>
8489

8590
<build>

src/main/java/fun/trackmoney/auth/infra/config/SecurityConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
3838
.requestMatchers(HttpMethod.POST, "/auth/register").permitAll()
3939
.requestMatchers(HttpMethod.GET, "/health/**").permitAll()
4040
.requestMatchers(HttpMethod.GET, "/actuator/**").permitAll()
41+
.requestMatchers("/swagger-ui/**", "/v3/api-docs/**").permitAll()
4142
.anyRequest().authenticated()
4243
)
4344
.addFilterBefore(securityFilter, UsernamePasswordAuthenticationFilter.class);

src/main/java/fun/trackmoney/exception/config/RestExceptionHandler.java renamed to src/main/java/fun/trackmoney/config/exception/RestExceptionHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package fun.trackmoney.exception.config;
1+
package fun.trackmoney.config.exception;
22

33
import fun.trackmoney.user.exception.EmailAlreadyExistsException;
44
import fun.trackmoney.user.exception.PasswordNotValid;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package fun.trackmoney.config.swagger;
2+
3+
import io.swagger.v3.oas.models.OpenAPI;
4+
import io.swagger.v3.oas.models.info.Info;
5+
import org.springframework.context.annotation.Bean;
6+
import org.springframework.context.annotation.Configuration;
7+
8+
@Configuration
9+
public class SwaggerConfig {
10+
11+
@Bean
12+
public OpenAPI customOpenAPI() {
13+
return new OpenAPI()
14+
.info(new Info()
15+
.title("TrackMoney API Manager Finance")
16+
.version("v1")
17+
.description("This is the backend part of a full-stack financial management application, " +
18+
"designed to handle essential features like user authentication, CRUD operations " +
19+
"for financial resources (transactions, budgets, recurring accounts), and more. " +
20+
"The backend is built using Java 17, Spring Boot, Spring Security, and follows " +
21+
"the Clean Architecture principles. It is integrated with a PostgreSQL database " +
22+
"and includes a CI/CD pipeline for continuous integration and deployment."));
23+
}
24+
}

src/main/java/fun/trackmoney/user/dtos/UserRequestDTO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
public record UserRequestDTO(
77
@NotBlank(message = "Name is required")
88
String name,
9-
@Email(message = "Email inlaid")
9+
@Email(message = "Email is invalid")
1010
@NotBlank
1111
String email,
1212
@NotBlank(message = "Password is required")

src/test/java/fun/trackmoney/exception/config/RestExceptionHandlerTest.java renamed to src/test/java/fun/trackmoney/config/exception/RestExceptionHandlerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package fun.trackmoney.exception.config;
1+
package fun.trackmoney.config.exception;
22

33
import fun.trackmoney.user.exception.EmailAlreadyExistsException;
44
import fun.trackmoney.user.exception.PasswordNotValid;

0 commit comments

Comments
 (0)