Class OpenApiCoverageReporter
java.lang.Object
com.shaft.api.internal.OpenApiCoverageReporter
Collects OpenAPI operation coverage from SHAFT API requests and reuses parsed validators.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidrecordInteraction(String specUrlOrDefinition, RestActions.RequestType requestType, String requestPath, Throwable failure) Records one API interaction against the configured OpenAPI document.static AssertionErrorLogs and attaches the OpenAPI coverage report, returning a threshold failure when configured.static voidEnables coverage collection for a spec and remembers the current threshold.static com.atlassian.oai.validator.restassured.OpenApiValidationFiltervalidationFilter(String specUrlOrDefinition) Returns a cached OpenAPI validation filter for the supplied spec.
-
Method Details
-
validationFilter
public static com.atlassian.oai.validator.restassured.OpenApiValidationFilter validationFilter(String specUrlOrDefinition) Returns a cached OpenAPI validation filter for the supplied spec.- Parameters:
specUrlOrDefinition- OpenAPI URL, path, or inline definition- Returns:
- cached REST Assured validation filter
-
start
Enables coverage collection for a spec and remembers the current threshold.- Parameters:
specUrlOrDefinition- OpenAPI URL, path, or inline definitionthreshold- required coverage percentage from0to100
-
recordInteraction
public static void recordInteraction(String specUrlOrDefinition, RestActions.RequestType requestType, String requestPath, Throwable failure) Records one API interaction against the configured OpenAPI document.- Parameters:
specUrlOrDefinition- OpenAPI URL, path, or inline definitionrequestType- HTTP methodrequestPath- request pathfailure- validation failure, when one occurred
-
reportAndGetThresholdFailure
Logs and attaches the OpenAPI coverage report, returning a threshold failure when configured.- Returns:
- threshold failure, or
nullwhen the run satisfies configured coverage
-