Skip to content

Commit e1492f4

Browse files
committed
Finishing Task 12
1 parent 98df428 commit e1492f4

File tree

4 files changed

+513
-32
lines changed

4 files changed

+513
-32
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
package info.jab.ms.config;
2+
3+
import io.swagger.v3.oas.models.OpenAPI;
4+
import io.swagger.v3.oas.models.info.Contact;
5+
import io.swagger.v3.oas.models.info.Info;
6+
import io.swagger.v3.oas.models.info.License;
7+
import io.swagger.v3.oas.models.servers.Server;
8+
import io.swagger.v3.oas.models.tags.Tag;
9+
import java.util.List;
10+
import org.springframework.context.annotation.Bean;
11+
import org.springframework.context.annotation.Configuration;
12+
13+
/**
14+
* OpenAPI Configuration for Film Query Service
15+
*
16+
* Task 12.1: Complete OpenAPI documentation with proper descriptions ✅
17+
*
18+
* This configuration provides comprehensive API documentation including:
19+
* - API information, version, and description
20+
* - Contact information and license
21+
* - Server configurations for different environments
22+
* - Global tags and enhanced documentation structure
23+
*/
24+
@Configuration
25+
public class OpenApiConfig {
26+
27+
@Bean
28+
public OpenAPI filmQueryOpenAPI() {
29+
return new OpenAPI()
30+
.info(new Info()
31+
.title("Film Query API")
32+
.description("""
33+
## Sakila Film Database Query Service
34+
35+
This REST API provides access to film information from the PostgreSQL Sakila sample database.
36+
The service allows querying films by their starting letter with high performance guarantees.
37+
38+
### Key Features
39+
- **Case-insensitive search**: Query films starting with any letter (A-Z)
40+
- **High performance**: Guaranteed response time under 2 seconds
41+
- **Comprehensive validation**: Input parameter validation with detailed error responses
42+
- **RFC 7807 compliance**: Standardized error response format
43+
44+
### Expected Results
45+
The API returns accurate counts based on the Sakila database:
46+
- Films starting with "A": 46 films
47+
- Films starting with "B": 37 films
48+
- Films starting with "C": 57 films
49+
50+
### Performance Guarantees
51+
- Query execution time: < 2 seconds
52+
- Database connection timeout: 30 seconds
53+
- Maximum response payload: Optimized for all result sets
54+
55+
### Error Handling
56+
All errors follow RFC 7807 Problem Details standard with:
57+
- Structured error responses
58+
- Unique error identifiers
59+
- Detailed error descriptions
60+
- HTTP status code compliance
61+
""")
62+
.version("1.0.0")
63+
.contact(new Contact()
64+
.name("Film Query API Team")
65+
.email("api-support@example.com")
66+
.url("https://github.com/your-org/film-query-service"))
67+
.license(new License()
68+
.name("MIT License")
69+
.url("https://opensource.org/licenses/MIT")))
70+
.servers(List.of(
71+
new Server()
72+
.url("http://localhost:8080")
73+
.description("Local development server"),
74+
new Server()
75+
.url("https://api-staging.example.com")
76+
.description("Staging environment"),
77+
new Server()
78+
.url("https://api.example.com")
79+
.description("Production environment")))
80+
.tags(List.of(
81+
new Tag()
82+
.name("Films")
83+
.description("Film query operations for retrieving films from the Sakila database by starting letter"),
84+
new Tag()
85+
.name("Health")
86+
.description("Service health and monitoring endpoints")));
87+
}
88+
}

0 commit comments

Comments
 (0)