fix(p2): Wave 3 — fix 4 P2 backend architecture issues (TEC-261)
BACK-I-01: Add CI steps to generate openapi.yaml for all 24 .NET services
- Add .config/dotnet-tools.json with swashbuckle.aspnetcore.cli 7.2.0
- Add scripts/ci/generate-openapi.sh reusable script
- Update all 24 service CI workflows with dotnet tool restore + swagger tofile + artifact upload
BACK-I-02: Add OpenTelemetry Metrics + Prometheus /metrics to _template_dot_net
- Add OTel packages (Extensions.Hosting, Instrumentation.AspNetCore, Runtime, Prometheus)
- Register AddOpenTelemetry().WithMetrics() with ASPNetCore + Runtime instrumentation
- Map MapPrometheusScrapingEndpoint("/metrics") in middleware pipeline
BACK-W-01: Remove IHttpContextAccessor from all 18 handler files in merchant-service-net
- Create MerchantBaseController abstract base with GetCurrentUserId() helper
- Add Guid UserId to 11 Commands and 7 Queries
- Remove IHttpContextAccessor injection from all handlers, use request.UserId instead
- Update 7 controllers to inherit MerchantBaseController and extract userId from JWT claims
- Remove AddHttpContextAccessor() registration from Program.cs
BACK-W-03: Add explicit commandTimeout:5 to all Dapper queries in order-service-net
- 14 files updated: QueryAsync, ExecuteScalarAsync, QueryFirstOrDefaultAsync all get commandTimeout: 5
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
36
scripts/ci/generate-openapi.sh
Executable file
36
scripts/ci/generate-openapi.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# EN: Generate OpenAPI spec (openapi.yaml) for a .NET microservice using dotnet swagger tofile.
|
||||
# Usage: generate-openapi.sh <service-dir> <api-project-name>
|
||||
# Example: generate-openapi.sh services/iam-service-net IamService.API
|
||||
#
|
||||
# VI: Tạo OpenAPI spec (openapi.yaml) cho .NET microservice dùng dotnet swagger tofile.
|
||||
# Sử dụng: generate-openapi.sh <service-dir> <api-project-name>
|
||||
# Ví dụ: generate-openapi.sh services/iam-service-net IamService.API
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SERVICE_DIR="${1:?Usage: $0 <service-dir> <api-project-name>}"
|
||||
API_PROJECT="${2:?Usage: $0 <service-dir> <api-project-name>}"
|
||||
|
||||
CSPROJ="$SERVICE_DIR/src/$API_PROJECT/$API_PROJECT.csproj"
|
||||
DLL="$SERVICE_DIR/src/$API_PROJECT/bin/Release/net10.0/$API_PROJECT.dll"
|
||||
OUTPUT="$SERVICE_DIR/openapi.yaml"
|
||||
|
||||
echo "[generate-openapi] Service: $API_PROJECT"
|
||||
echo "[generate-openapi] Output: $OUTPUT"
|
||||
|
||||
# EN: Build the API project if not already built / VI: Build API project nếu chưa build
|
||||
if [ ! -f "$DLL" ]; then
|
||||
echo "[generate-openapi] Building $API_PROJECT..."
|
||||
dotnet build "$CSPROJ" --configuration Release --no-restore
|
||||
fi
|
||||
|
||||
# EN: Generate OpenAPI YAML using dotnet-swagger (Swashbuckle CLI)
|
||||
# VI: Tạo OpenAPI YAML dùng dotnet-swagger (Swashbuckle CLI)
|
||||
dotnet swagger tofile \
|
||||
--output "$OUTPUT" \
|
||||
--yaml \
|
||||
"$DLL" \
|
||||
v1
|
||||
|
||||
echo "[generate-openapi] Generated: $OUTPUT"
|
||||
Reference in New Issue
Block a user