Add validation module: Bean Validation on Spring Boot 4.2.0 with Hibernate Validator 9.1.6, built-in and custom constraints, groups, method validation, ProblemDetail errors, message i18n, JPA integration and tests, with real transcripts
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4RzcCS5JCAgcxLz7T
This commit is contained in:
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regenerates every file in output/. Needs JDK 25 and Maven.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
mkdir -p output target
|
||||
|
||||
mvn -B -q dependency:list -DoutputFile=target/deps.txt
|
||||
grep -E ':(spring-boot|spring-core|hibernate-validator|jakarta\.validation-api|tomcat-embed-el|hibernate-core|junit-jupiter-api):' target/deps.txt \
|
||||
| sed -E 's/ -- module.*//; s/^ +//' | sort > output/00-versions.txt
|
||||
java -version 2>&1 | grep -v 'Picked up' | head -1 >> output/00-versions.txt
|
||||
|
||||
mvn -B test > target/test.log 2>&1
|
||||
grep -o "HV000271: .*ContainerValid#items()" target/test.log | head -1 > output/19-container-valid-warning.txt
|
||||
|
||||
# Plain Java, with and without an Expression Language implementation
|
||||
( cd examples/plain-java && mvn -B -q compile dependency:build-classpath -Dmdep.outputFile=target/cp.txt )
|
||||
FULL="examples/plain-java/target/classes:$(cat examples/plain-java/target/cp.txt)"
|
||||
NOEL=$(echo "$FULL" | tr ':' '\n' | grep -v -E 'expressly|jakarta\.el' | paste -sd:)
|
||||
run() { java -Duser.language=en -cp "$1" PlainJava ${2:-} 2>&1 | grep -v -E 'Picked up|HV000001|<clinit>|ParameterMessageInterpolator interpolate' ; }
|
||||
{
|
||||
echo "== with expressly on the classpath"
|
||||
run "$FULL"
|
||||
echo
|
||||
echo "== without any Jakarta EL implementation"
|
||||
run "$NOEL" | grep -m2 -E 'ValidationException|HV000183' || true
|
||||
echo
|
||||
echo "== without EL, using ParameterMessageInterpolator"
|
||||
run "$NOEL" no-el
|
||||
} > output/20-plain-java.txt
|
||||
|
||||
mkdir -p target/record
|
||||
javac -d target/record examples/record-target/RecordTarget.java 2>&1 | grep -v 'Picked up' || true
|
||||
{ echo "== javac and run"; java -cp target/record RecordTarget 2>&1 | grep -v 'Picked up'; } > output/21-record-target.txt
|
||||
# The same ProblemDetail test on the previous minor, to compare the response bodies
|
||||
OLD=$(mktemp -d)
|
||||
cp -r pom.xml src "$OLD"/ && mkdir "$OLD/output"
|
||||
sed -i 's#<version>4.2.0</version>#<version>4.1.3</version>#' "$OLD/pom.xml"
|
||||
( cd "$OLD" && mvn -B -q test -Dtest=ProblemDetailsPropertyTest > test.log 2>&1 )
|
||||
cp "$OLD/output/10-http-problemdetails-property.txt" output/22-http-problemdetails-property-on-4.1.3.txt
|
||||
echo done
|
||||
Reference in New Issue
Block a user