Skip to content

Commit 6a57880

Browse files
committed
docs(sql): fix documentation validation errors
Add missing documentation tags to operators: - src/operators/<>.sql: Add @param and @return for JSONB overload - src/operators/~~.sql: Add @brief, @param, @return for operator Add validation script: - tasks/validate-documented-sql.sh: SQL syntax validation (optional) These fixes ensure all documented functions have required @brief, @param, and @return tags for proper Doxygen output. Source: phase-4-doxygen commit b4d6b4d, 01ab2f8
1 parent 150a85d commit 6a57880

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

src/operators/<>.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ CREATE OPERATOR <> (
8383
);
8484

8585
--! @brief <> operator for JSONB and encrypted value
86+
--!
87+
--! @param a jsonb Plain JSONB value
88+
--! @param b eql_v2_encrypted Encrypted value
89+
--! @return boolean True if values are not equal
90+
--!
8691
--! @see eql_v2."<>"(eql_v2_encrypted, eql_v2_encrypted)
8792
CREATE FUNCTION eql_v2."<>"(a jsonb, b eql_v2_encrypted)
8893
RETURNS boolean

src/operators/~~.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ $$ LANGUAGE SQL;
6363
--! SELECT * FROM customers
6464
--! WHERE encrypted_name ~~ 'John%'::text::eql_v2_encrypted;
6565
--!
66+
--! @brief SQL LIKE operator (~~ operator) for encrypted text pattern matching
67+
--!
68+
--! @param a eql_v2_encrypted Left operand (encrypted value)
69+
--! @param b eql_v2_encrypted Right operand (encrypted pattern)
70+
--! @return boolean True if pattern matches
71+
--!
6672
--! @note Requires match index: eql_v2.add_search_config(table, column, 'match')
6773
--! @see eql_v2.like
6874
--! @see eql_v2.add_search_config

tasks/validate-documented-sql.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
# tasks/validate-documented-sql.sh
3+
# Validates SQL syntax for all documented files
4+
5+
set -e
6+
7+
cd "$(dirname "$0")/.."
8+
9+
PGHOST=${PGHOST:-localhost}
10+
PGPORT=${PGPORT:-7432}
11+
PGUSER=${PGUSER:-cipherstash}
12+
PGPASSWORD=${PGPASSWORD:-password}
13+
PGDATABASE=${PGDATABASE:-postgres}
14+
15+
echo "Validating SQL syntax for all documented files..."
16+
echo ""
17+
18+
errors=0
19+
validated=0
20+
21+
for file in $(find src -name "*.sql" -not -name "*_test.sql" | sort); do
22+
echo -n "Validating $file... "
23+
24+
# Capture both stdout and stderr
25+
error_output=$(PGPASSWORD="$PGPASSWORD" psql -h "$PGHOST" -p "$PGPORT" -U "$PGUSER" -d "$PGDATABASE" \
26+
-f "$file" --set ON_ERROR_STOP=1 -q 2>&1) || exit_code=$?
27+
28+
if [ "${exit_code:-0}" -eq 0 ]; then
29+
echo ""
30+
validated=$((validated + 1))
31+
else
32+
echo "✗ SYNTAX ERROR"
33+
echo " Error in: $file"
34+
echo " Details:"
35+
echo "$error_output" | tail -10 | sed 's/^/ /'
36+
echo ""
37+
errors=$((errors + 1))
38+
fi
39+
exit_code=0
40+
done
41+
42+
echo ""
43+
echo "Validation complete:"
44+
echo " Validated: $validated"
45+
echo " Errors: $errors"
46+
47+
if [ $errors -gt 0 ]; then
48+
echo ""
49+
echo "❌ Validation failed with $errors errors"
50+
exit 1
51+
else
52+
echo ""
53+
echo "✅ All SQL files validated successfully"
54+
exit 0
55+
fi

0 commit comments

Comments
 (0)