Spaces:
Sleeping
Sleeping
Download .github/scripts/validate-postman.sh from neurostack-in/talk2map-test: direct link, hf CLI and curl.
- Browser
- Download file 2.71 kB
-
https://huggingface.co/spaces/neurostack-in/talk2map-test/resolve/main/.github/scripts/validate-postman.sh
- Command line
-
hf download hf://spaces/neurostack-in/talk2map-test/.github/scripts/validate-postman.sh
-
curl -L -o validate-postman.sh https://huggingface.co/spaces/neurostack-in/talk2map-test/resolve/main/.github/scripts/validate-postman.sh
2.71 kB
| # Postman Collection Validator | |
| # This script validates the Talk2Map Postman collection before running tests | |
| echo "π Validating Postman collection..." | |
| # Check if collection file exists | |
| if [ ! -f "Talk2Map.postman_collection.json" ]; then | |
| echo "β Postman collection file not found!" | |
| exit 1 | |
| fi | |
| # Check if collection is valid JSON | |
| if ! jq empty Talk2Map.postman_collection.json 2>/dev/null; then | |
| echo "β Invalid JSON in Postman collection!" | |
| exit 1 | |
| fi | |
| # Extract collection info | |
| collection_name=$(jq -r '.info.name' Talk2Map.postman_collection.json) | |
| echo "β Collection: $collection_name" | |
| # Count requests | |
| request_count=$(jq '[.item[].request] | length' Talk2Map.postman_collection.json) | |
| echo "β Total requests: $request_count" | |
| # List all request names | |
| echo "π Available endpoints:" | |
| jq -r '.item[].name' Talk2Map.postman_collection.json | sed 's/^/ - /' | |
| # Check for required variables | |
| if jq -e '.variable[] | select(.key=="baseUrl")' Talk2Map.postman_collection.json > /dev/null; then | |
| default_url=$(jq -r '.variable[] | select(.key=="baseUrl") | .value' Talk2Map.postman_collection.json) | |
| echo "β Base URL variable found (default: $default_url)" | |
| else | |
| echo "β οΈ No baseUrl variable found in collection" | |
| fi | |
| # Validate bounding_box requirements for Talk2Map API | |
| echo "π Checking bounding_box requirements..." | |
| missing_bbox_count=0 | |
| # Check each request for bounding_box field (excluding health check) | |
| for i in $(jq '.item | to_entries[] | select(.value.name != "Health") | .key' Talk2Map.postman_collection.json); do | |
| request_name=$(jq -r ".item[$i].name" Talk2Map.postman_collection.json) | |
| # Only check the main request body (not originalRequest in responses) | |
| if jq -e ".item[$i].request.body.raw" Talk2Map.postman_collection.json > /dev/null; then | |
| raw_body=$(jq -r ".item[$i].request.body.raw" Talk2Map.postman_collection.json) | |
| # Parse the raw JSON body and check for bounding_box | |
| if echo "$raw_body" | jq -e '.bounding_box' > /dev/null 2>&1; then | |
| echo "β Has bounding_box: $request_name" | |
| else | |
| echo "β Missing bounding_box in: $request_name" | |
| echo " Raw body preview: $(echo "$raw_body" | head -c 100)..." | |
| ((missing_bbox_count++)) | |
| fi | |
| else | |
| echo "β οΈ No request body found for: $request_name" | |
| fi | |
| done | |
| if [ $missing_bbox_count -gt 0 ]; then | |
| echo "β $missing_bbox_count requests missing required bounding_box field!" | |
| echo "Talk2Map API requires bounding_box for all /chat endpoints." | |
| exit 1 | |
| fi | |
| echo "β All requests have required bounding_box field!" | |
| echo "β Postman collection validation complete!" |