Interface ContractVerificationSource

All Known Implementing Classes:
OpenApiRequestValidatorScanner, RestDocsScanner, SpringCloudContractScanner

public interface ContractVerificationSource
A pluggable source of "this endpoint's contract is verified" evidence.

An endpoint is considered verified as soon as any one source reports evidence for it, not all of them - teams may adopt Spring RestDocs, the Atlassian OpenAPI request validator, and Spring Cloud Contract incrementally, in any combination, so the sources are never required to agree.

Each implementation owns its own recursive directory walk and file-type filtering, since the three built-in sources scan different file types under different root directories.

  • Method Summary

    Modifier and Type
    Method
    Description
    List<com.arc_e_tect.gradle.detector.core.model.Endpoint>
    scan(File rootDir)
    Scans rootDir recursively and returns every endpoint this source found verification evidence for.
    Scans rootDir recursively, same as 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.
  • Method Details

    • scan

      List<com.arc_e_tect.gradle.detector.core.model.Endpoint> scan(File rootDir) throws IOException
      Scans rootDir recursively and returns every endpoint this source found verification evidence for.

      The returned Endpoint.declaringClass() and Endpoint.methodSignature() identify the test (or contract file) that supplied the evidence, not a production @RestController.

      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 under rootDir cannot be read
    • scanWithStatusCodes

      default List<VerifiedContractTest> scanWithStatusCodes(File rootDir) throws IOException
      Scans rootDir recursively, same as 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 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.

      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 under rootDir cannot be read