#!/bin/bash set -e # Get the root directory of the project ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$ROOT_DIR" echo "[API Update] Generating OpenAPI JSON from Rust Code..." # Run the specific test in api-gateway that dumps the JSON cargo test --manifest-path services/api-gateway/Cargo.toml --bin api-gateway openapi::tests::generate_openapi_json if [ -f "openapi.json" ]; then echo "[API Update] openapi.json generated successfully." else echo "[API Update] Error: openapi.json was not generated!" exit 1 fi echo "[API Update] Regenerating Frontend Types..." cd frontend npm run gen:api echo "[API Update] ✅ API Spec and Frontend Client updated successfully!"