Skip to content

HV-2245 Add @StartsWith constraint - #2093

Open
koentsje wants to merge 7 commits into
hibernate:mainfrom
koentsje:HV-2245
Open

HV-2245 Add @StartsWith constraint#2093
koentsje wants to merge 7 commits into
hibernate:mainfrom
koentsje:HV-2245

Conversation

@koentsje

Copy link
Copy Markdown
Member

Add a new @startsWith constraint that validates whether a character sequence starts with one or more specified prefixes (OR semantics), with an optional ignoreCase flag for case-insensitive matching.

Part of the "Extended set of constraints" epic (HV-2228).


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on licensing, please check here.


  - Add the initial implementation of constraint StartsWith

Signed-off-by: Koen Aers <koen.aers@gmail.com>
  - Add StartsWithValidator for CharSequence validation
  - Add StartsWithValidatorTest covering null, matching/non-matching prefix, empty prefix, case sensitivity, ignoreCase and OR semantics for multiple values

Signed-off-by: Koen Aers <koen.aers@gmail.com>
  - Register StartsWith in BuiltinConstraint and ConstraintHelper
  - Add validation message to ValidationMessages.properties
  - Update MessagePropertiesTest and PredefinedScopeAllConstraintsTest
  - Add StartsWithConstrainedTest covering direct field, ignoreCase and multiple values

Signed-off-by: Koen Aers <koen.aers@gmail.com>
  - Add StartsWithDef class

Signed-off-by: Koen Aers <koen.aers@gmail.com>
  - Add @testForissue(jiraKey = HV-2245) to StartsWithValidatorTest and StartsWithConstrainedTest
  - Add testProgrammaticDefinition test for StartsWithDef in StartsWithValidatorTest

Signed-off-by: Koen Aers <koen.aers@gmail.com>
  - Add STARTS_WITH constant to TypeNames
  - Register StartsWith for CharSequence in AP ConstraintHelper
  - Add ModelWithStartsWithConstraints test model
  - Add startsWithConstraints test to ConstraintValidationProcessorIT

Signed-off-by: Koen Aers <koen.aers@gmail.com>
  - Add @startsWith entry to the reference guide in chapter 2

Signed-off-by: Koen Aers <koen.aers@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
3.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@github-actions

Copy link
Copy Markdown

Documentation Preview

Documentation preview artifact not found for commit db4723a.
The documentation may not have changed, or the artifact may have expired.

View workflow run for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant