-
Notifications
You must be signed in to change notification settings - Fork 173
Expand file tree
/
Copy pathtest-swagger-docs.sh
More file actions
executable file
·145 lines (124 loc) · 4.19 KB
/
test-swagger-docs.sh
File metadata and controls
executable file
·145 lines (124 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
# Test script to verify Swagger documentation
echo "🔍 Testing Swagger Documentation Implementation..."
echo ""
# Check if main.ts has Swagger configuration
echo "✓ Checking main.ts configuration..."
if grep -q "DocumentBuilder" apps/backend/src/main.ts; then
echo " ✅ DocumentBuilder found"
else
echo " ❌ DocumentBuilder not found"
exit 1
fi
if grep -q "addBearerAuth" apps/backend/src/main.ts; then
echo " ✅ Bearer auth configured"
else
echo " ❌ Bearer auth not configured"
exit 1
fi
if grep -q "addTag" apps/backend/src/main.ts; then
echo " ✅ API tags configured"
else
echo " ❌ API tags not configured"
exit 1
fi
echo ""
echo "✓ Checking controller decorators..."
# Check Auth Controller
if grep -q "@ApiTags('auth')" apps/backend/src/auth/auth.controller.ts; then
echo " ✅ Auth controller has @ApiTags"
else
echo " ❌ Auth controller missing @ApiTags"
fi
# Check Users Controller
if grep -q "@ApiTags('users')" apps/backend/src/users/users.controller.ts; then
echo " ✅ Users controller has @ApiTags"
else
echo " ❌ Users controller missing @ApiTags"
fi
# Check News Controller
if grep -q "@ApiTags('news')" apps/backend/src/news/news.controller.ts; then
echo " ✅ News controller has @ApiTags"
else
echo " ❌ News controller missing @ApiTags"
fi
# Check Portfolio Controller
if grep -q "@ApiTags('portfolio')" apps/backend/src/portfolio/portfolio.controller.ts; then
echo " ✅ Portfolio controller has @ApiTags"
else
echo " ❌ Portfolio controller missing @ApiTags"
fi
# Check Stellar Controller
if grep -q "@ApiTags('stellar')" apps/backend/src/stellar/stellar.controller.ts; then
echo " ✅ Stellar controller has @ApiTags"
else
echo " ❌ Stellar controller missing @ApiTags"
fi
echo ""
echo "✓ Checking DTO decorators..."
# Check Auth DTOs
if grep -q "@ApiProperty" apps/backend/src/auth/dto/login.dto.ts; then
echo " ✅ LoginDto has @ApiProperty"
else
echo " ❌ LoginDto missing @ApiProperty"
fi
if grep -q "@ApiProperty" apps/backend/src/auth/dto/register.dto.ts; then
echo " ✅ RegisterDto has @ApiProperty"
else
echo " ❌ RegisterDto missing @ApiProperty"
fi
# Check News DTOs
if grep -q "@ApiProperty" apps/backend/src/news/dto/news-article.dto.ts; then
echo " ✅ News DTOs have @ApiProperty"
else
echo " ❌ News DTOs missing @ApiProperty"
fi
# Check Portfolio DTOs
if grep -q "@ApiProperty" apps/backend/src/portfolio/dto/portfolio-snapshot.dto.ts; then
echo " ✅ Portfolio DTOs have @ApiProperty"
else
echo " ❌ Portfolio DTOs missing @ApiProperty"
fi
echo ""
echo "✓ Checking documentation files..."
if [ -f "document/api-documentation-guide.md" ]; then
echo " ✅ API Documentation Guide exists"
else
echo " ❌ API Documentation Guide missing"
fi
if [ -f "document/swagger-implementation-guide.md" ]; then
echo " ✅ Swagger Implementation Guide exists"
else
echo " ❌ Swagger Implementation Guide missing"
fi
if [ -f "document/swagger-documentation-summary.md" ]; then
echo " ✅ Swagger Documentation Summary exists"
else
echo " ❌ Swagger Documentation Summary missing"
fi
echo ""
echo "✓ Checking build..."
cd apps/backend
if npm run build > /dev/null 2>&1; then
echo " ✅ Backend builds successfully"
else
echo " ❌ Backend build failed"
exit 1
fi
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "✅ All Swagger documentation checks passed!"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "📚 Documentation available at:"
echo " • Swagger UI: http://localhost:3000/api/docs"
echo " • OpenAPI JSON: http://localhost:3000/api/docs-json"
echo ""
echo "📖 Documentation files:"
echo " • document/api-documentation-guide.md"
echo " • document/swagger-implementation-guide.md"
echo " • document/swagger-documentation-summary.md"
echo ""
echo "🚀 To start the server:"
echo " cd apps/backend && npm run start:dev"
echo ""