Loading…
Loading…
Reference for Contract API reference: every documented symbol, parameter, and endpoint.
This reference documents utilities for validating scalar field values against contract-defined regular expression patterns and length constraints. The components also provide functionality for generating a representative example string that conforms to a given pattern facet. The validation logic implements a specific retry semantic: if a strict pattern match fails but a length facet is also present, the match is retried with an implicit quantifier.
| Name | Kind | Signature | Description |
|---|---|---|---|
| ContractPatternValidator | class | public final class ContractPatternValidator | Shared contract pattern + length validator for SOAP↔REST scalar fields. Implements the Yb retry-with-implicit-quantifier semantics: when a strict Pattern.matches(pattern, value) fails AND the contract has a length facet (maxLength or length/exactLength) AND the stored pattern lacks a trailing quantifier suffix (*, +, ?, or a {@code {n,m}} block), retry with implicit * semantics — i.e. treat the pattern as a per-character allow-list. This mirrors the original XSD pattern-facet behaviour for patterns whose trailing quantifier was stripped at import time by Y contract cleaning. This class is duplicated byte-identical between services/runtime/ and services/admin-api/ (only the package declaration differs). scripts/check-validator-sync.ps1 enforces drift-free copies; the pre-commit hook + scripts/build-images.ps1 run it. Ye — refactor of the duplicated helpers in SoapMessageMapper (runtime + admin-api) and ContractExampleService (admin-api) into a single canonical implementation. Behaviour is byte-identical to the deployed Yb + Yc helpers at commit f86caff7. |
| ContractPatternValidator | class | public final class ContractPatternValidator | Shared contract pattern + length validator for SOAP↔REST scalar fields. Implements the Yb retry-with-implicit-quantifier semantics: when a strict Pattern.matches(pattern, value) fails AND the contract has a length facet (maxLength or length/exactLength) AND the stored pattern lacks a trailing quantifier suffix (*, +, ?, or a {@code {n,m}} block), retry with implicit * semantics — i.e. treat the pattern as a per-character allow-list. This mirrors the original XSD pattern-facet behaviour for patterns whose trailing quantifier was stripped at import time by Y contract cleaning. This class is duplicated byte-identical between services/runtime/ and services/admin-api/ (only the package declaration differs). scripts/check-validator-sync.ps1 enforces drift-free copies; the pre-commit hook + scripts/build-images.ps1 run it. Ye — refactor of the duplicated helpers in SoapMessageMapper (runtime + admin-api) and ContractExampleService (admin-api) into a single canonical implementation. Behaviour is byte-identical to the deployed Yb + Yc helpers at commit f86caff7. |
| RegexExampleGenerator | class | public final class RegexExampleGenerator | Generates ONE representative string that matches a regular expression, used to seed example values for contract fields that declare an xsd:pattern facet. Without it, the example generator emits a type-default (e.g. 1 for an xsd:int) that ignores the pattern, and the WSDL-import round-trip gate then rejects the platform's own example with S2R-ADM-0612 ("value does not match pattern...") — blocking a valid import (real case: field actTaarich, an xsd:int whose pattern requires a YYYYMMDD date). Supports the constructs that actually appear in XSD/WSDL patterns: literals,., escapes (\d \w \s \D \W \S and -/. literal escapes), character classes [..] / [^..] with ranges, grouping (..) and (?:..), alternation \ |
| generate | method | public static Optional<String> generate(String rawPattern) | — |
| matches | method | public static boolean matches(String pattern, String value, Integer exactLength, Integer maxLength) | Boolean form of pattern matching with the Yb retry-with-implicit-quantifier safety net. Returns true when the value satisfies the pattern (strict OR retry); false otherwise. Used by example generation paths that want a simple yes/no answer rather than a violation reason. @param pattern contract regex pattern @param value value to test @param exactLength contract length facet (may be null) @param maxLength contract maxLength facet (may be null) @return true on match (strict or implicit-quantifier retry) |
| matches | method | public static boolean matches(String pattern, String value, Integer exactLength, Integer maxLength) | Boolean form of pattern matching with the Yb retry-with-implicit-quantifier safety net. Returns true when the value satisfies the pattern (strict OR retry); false otherwise. Used by example generation paths that want a simple yes/no answer rather than a violation reason. @param pattern contract regex pattern @param value value to test @param exactLength contract length facet (may be null) @param maxLength contract maxLength facet (may be null) @return true on match (strict or implicit-quantifier retry) |
| render | method | void render(StringBuilder out) | — |
| render | method | public void render(StringBuilder out) | — |
| render | method | public void render(StringBuilder out) | — |
| render | method | public void render(StringBuilder out) | — |
| render | method | public void render(StringBuilder out) | — |
| render | method | public void render(StringBuilder out) | — |
| validate | method | public static String validate(String pattern, String value, Integer exactLength, Integer maxLength) | Validate value against the contract pattern with the Yb retry-with-implicit-quantifier safety net. Returns null if the value matches (or there is no pattern to enforce); otherwise a human-readable violation reason. @param pattern contract regex pattern (may be null/blank) @param value value to validate (may be null) @param exactLength contract length facet (may be null) @param maxLength contract maxLength facet (may be null) @return null on accept; violation reason on reject |
| validate | method | public static String validate(String pattern, String value, Integer exactLength, Integer maxLength) | Validate value against the contract pattern with the Yb retry-with-implicit-quantifier safety net. Returns null if the value matches (or there is no pattern to enforce); otherwise a human-readable violation reason. @param pattern contract regex pattern (may be null/blank) @param value value to validate (may be null) @param exactLength contract length facet (may be null) @param maxLength contract maxLength facet (may be null) @return null on accept; violation reason on reject |
| validateNode | method | public static String validateNode(Map<String, Object> node, String value) | Convenience: read pattern + length facets from a contract node map and delegate to #validate(String, String, Integer, Integer). @param node contract node map (may be null) @param value value to validate (may be null) @return null on accept; violation reason on reject |
| validateNode | method | public static String validateNode(Map<String, Object> node, String value) | Convenience: read pattern + length facets from a contract node map and delegate to #validate(String, String, Integer, Integer). @param node contract node map (may be null) @param value value to validate (may be null) @return null on accept; violation reason on reject |
| Parameter | Type |
|---|---|
| rawPattern | String |
Returns: Optional<String>
| Parameter | Type |
|---|---|
| pattern | String |
| value | String |
| exactLength | Integer |
| maxLength | Integer |
Returns: boolean
| Parameter | Type |
|---|---|
| out | StringBuilder |
Returns: void
| Parameter | Type |
|---|---|
| pattern | String |
| value | String |
| exactLength | Integer |
| maxLength | Integer |
Returns: String
| Parameter | Type |
|---|---|
| node | Map<String, Object> |
| value | String |
Returns: String
| Parameter | Type |
|---|---|
| node | Map<String, Object> |
| value | String |
Returns: String