Class OpenApiRequestValidatorScanner
java.lang.Object
com.arc_e_tect.gradle.doppelganger.scan.OpenApiRequestValidatorScanner
- All Implemented Interfaces:
ContractVerificationSource
ContractVerificationSource for the Atlassian OpenAPI request validator: a test method
whose call chain contains either .filter(new OpenApiValidationFilter(...)) (REST
Assured style) or a direct .validateRequest(...) / .validateResponse(...) call,
paired with a REST-Assured-style request built via given()...when()...get(...) calls in
the same method.
The library's Maven coordinates changed after v3.0.0 from swagger-request-validator-*
to openapi-request-validator-* under com.atlassian.oai; this scanner matches by
simple class/method names only, so both old and new artifact versions are recognised without
needing either on its own classpath.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newOpenApiRequestValidatorScannerthat resolves no configured helper-method calls or@Value-annotated fields.OpenApiRequestValidatorScanner(com.arc_e_tect.gradle.detector.core.scan.PropertyResolutionContext propertyResolutionContext) Creates a newOpenApiRequestValidatorScannerthat additionally resolves a request-builder call's path argument againstpropertyResolutionContextwhen it is a configured helper-method call or an@Value-annotated field, in addition to the literal/literal-initialized-constant shapesLiteralPathResolveralways resolves. -
Method Summary
Modifier and TypeMethodDescriptionList<com.arc_e_tect.gradle.detector.core.model.Endpoint> ScansrootDirrecursively and returns every endpoint this source found verification evidence for.scanWithStatusCodes(File rootDir) ScansrootDirrecursively, same asContractVerificationSource.scan(File), but additionally reports the HTTP status code each piece of evidence was detected to assert, when a source is able to determine one.
-
Constructor Details
-
OpenApiRequestValidatorScanner
public OpenApiRequestValidatorScanner()Creates a newOpenApiRequestValidatorScannerthat resolves no configured helper-method calls or@Value-annotated fields. -
OpenApiRequestValidatorScanner
public OpenApiRequestValidatorScanner(com.arc_e_tect.gradle.detector.core.scan.PropertyResolutionContext propertyResolutionContext) Creates a newOpenApiRequestValidatorScannerthat additionally resolves a request-builder call's path argument againstpropertyResolutionContextwhen it is a configured helper-method call or an@Value-annotated field, in addition to the literal/literal-initialized-constant shapesLiteralPathResolveralways resolves.- Parameters:
propertyResolutionContext- out-of-band property knowledge; passPropertyResolutionContext.empty()for none
-
-
Method Details
-
scan
public List<com.arc_e_tect.gradle.detector.core.model.Endpoint> scan(File rootDir) throws IOException ScansrootDirrecursively and returns every endpoint this source found verification evidence for.The returned
Endpoint.declaringClass()andEndpoint.methodSignature()identify the test (or contract file) that supplied the evidence, not a production@RestController.- Specified by:
scanin interfaceContractVerificationSource- Parameters:
rootDir- the directory to scan recursively; scanning a non-existent or non-directory path returns an empty list rather than failing- Returns:
- possibly-empty list of verified endpoints, never
null - Throws:
IOException- if a file underrootDircannot be read
-
scanWithStatusCodes
ScansrootDirrecursively, same asContractVerificationSource.scan(File), but additionally reports the HTTP status code each piece of evidence was detected to assert, when a source is able to determine one.The default implementation delegates to
ContractVerificationSource.scan(File)and reports every entry with no status code, so an implementation that has no meaningful way to detect one simply inherits correct, backward-compatible behavior without overriding anything.- Specified by:
scanWithStatusCodesin interfaceContractVerificationSource- Parameters:
rootDir- the directory to scan recursively; scanning a non-existent or non-directory path returns an empty list rather than failing- Returns:
- possibly-empty list of verified contract tests, never
null - Throws:
IOException- if a file underrootDircannot be read
-