Skip to content

Commit 2ae8825

Browse files
committed
feat(AIENG:420): Add command to download OpenAPI schema for Smart Tests API
1 parent 542ca30 commit 2ae8825

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

scripts/update_schema.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,18 @@ mkdir -p "$(dirname "$SCHEMA_FILE")"
2121
# Fetch and save schema
2222
curl -s http://localhost:8080/intake/v3/api-docs > "$SCHEMA_FILE"
2323

24-
# Validate it's valid JSON
25-
if ! python3 -m json.tool "$SCHEMA_FILE" > /dev/null 2>&1; then
26-
echo "Error: Downloaded file is not valid JSON"
27-
exit 1
28-
fi
24+
# Validate and format the JSON with proper indentation and trailing newline
25+
python3 << PYTHON_EOF
26+
import json
27+
28+
with open("$SCHEMA_FILE", 'r') as f:
29+
schema = json.load(f)
30+
31+
# Write back with proper formatting
32+
with open("$SCHEMA_FILE", 'w') as f:
33+
json.dump(schema, f, indent=2)
34+
f.write('\n') # Add trailing newline
35+
PYTHON_EOF
2936

3037
echo "✓ Schema updated successfully: $SCHEMA_FILE"
3138
echo ""

smart_tests/schema/openapi-schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2879,4 +2879,4 @@
28792879
}
28802880
}
28812881
}
2882-
}
2882+
}

0 commit comments

Comments
 (0)