Class ShadowApiReportWriter

java.lang.Object
com.arc_e_tect.gradle.shadow.report.ShadowApiReportWriter

public class ShadowApiReportWriter extends Object
Writes the AsciiDoc shadow API report: every @RestController endpoint that is not described in the configured OpenAPI documentation.

Every report opens with a preamble explaining what a shadow API is, loaded from the "shadow-api-preamble.adoc" classpath resource so that explanatory text can be revised without touching this class.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new ShadowApiReportWriter.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    write(File outputFile, int totalEndpointCount, List<com.arc_e_tect.gradle.detector.core.model.Endpoint> shadows, String systemUnderTestVersion)
    Writes the report to outputFile, creating its parent directory if necessary.
    void
    write(File outputFile, int totalEndpointCount, List<com.arc_e_tect.gradle.detector.core.model.Endpoint> shadows, String systemUnderTestVersion, List<String> warnings, Map<String,com.arc_e_tect.gradle.detector.core.progress.ContractProgressRecord> contractHistory)
    Writes the report to outputFile, creating its parent directory if necessary.
    void
    write(File outputFile, int totalEndpointCount, List<com.arc_e_tect.gradle.detector.core.model.Endpoint> shadows, String systemUnderTestVersion, Map<String,com.arc_e_tect.gradle.detector.core.progress.ContractProgressRecord> contractHistory)
    Writes the report to outputFile, creating its parent directory if necessary.
    void
    write(File outputFile, int totalEndpointCount, List<com.arc_e_tect.gradle.detector.core.model.Endpoint> shadows, List<com.arc_e_tect.gradle.detector.core.model.Endpoint> excludedImplementations, String systemUnderTestVersion, List<String> warnings, Map<String,com.arc_e_tect.gradle.detector.core.progress.ContractProgressRecord> contractHistory)
    Writes the report to outputFile, creating its parent directory if necessary.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ShadowApiReportWriter

      public ShadowApiReportWriter()
      Creates a new ShadowApiReportWriter.
  • Method Details

    • write

      public void write(File outputFile, int totalEndpointCount, List<com.arc_e_tect.gradle.detector.core.model.Endpoint> shadows, String systemUnderTestVersion) throws IOException
      Writes the report to outputFile, creating its parent directory if necessary. Equivalent to write(File, int, List, String, List, Map) with no warnings and an empty contract history.
      Parameters:
      outputFile - target AsciiDoc file
      totalEndpointCount - total number of endpoints found across all scanned controllers
      shadows - the endpoints not described in the OpenAPI documentation
      systemUnderTestVersion - version of the system under test that was scanned
      Throws:
      IOException - if the output file cannot be written
    • write

      public void write(File outputFile, int totalEndpointCount, List<com.arc_e_tect.gradle.detector.core.model.Endpoint> shadows, String systemUnderTestVersion, Map<String,com.arc_e_tect.gradle.detector.core.progress.ContractProgressRecord> contractHistory) throws IOException
      Writes the report to outputFile, creating its parent directory if necessary. Equivalent to write(File, int, List, String, List, Map) with no warnings.
      Parameters:
      outputFile - target AsciiDoc file
      totalEndpointCount - total number of endpoints found across all scanned controllers
      shadows - the endpoints not described in the OpenAPI documentation
      systemUnderTestVersion - version of the system under test that was scanned
      contractHistory - contract progress history to render as a == Progress Over Time section, keyed by fingerprint; when empty, no such section is written
      Throws:
      IOException - if the output file cannot be written
    • write

      public void write(File outputFile, int totalEndpointCount, List<com.arc_e_tect.gradle.detector.core.model.Endpoint> shadows, String systemUnderTestVersion, List<String> warnings, Map<String,com.arc_e_tect.gradle.detector.core.progress.ContractProgressRecord> contractHistory) throws IOException
      Writes the report to outputFile, creating its parent directory if necessary. Equivalent to calling write(File, int, List, List, String, List, Map) with an empty excluded-implementations list.
      Parameters:
      outputFile - target AsciiDoc file
      totalEndpointCount - total number of endpoints found across all scanned controllers
      shadows - the endpoints not described in the OpenAPI documentation
      systemUnderTestVersion - version of the system under test that was scanned
      warnings - non-fatal configuration gaps to render as a WARNING admonition right after the report header - e.g. a configured rootDocument or controllerDirs entry that doesn't exist yet; when empty, no such admonition is written
      contractHistory - contract progress history to render as a == Progress Over Time section, keyed by fingerprint; when empty, no such section is written
      Throws:
      IOException - if the output file cannot be written
    • write

      public void write(File outputFile, int totalEndpointCount, List<com.arc_e_tect.gradle.detector.core.model.Endpoint> shadows, List<com.arc_e_tect.gradle.detector.core.model.Endpoint> excludedImplementations, String systemUnderTestVersion, List<String> warnings, Map<String,com.arc_e_tect.gradle.detector.core.progress.ContractProgressRecord> contractHistory) throws IOException
      Writes the report to outputFile, creating its parent directory if necessary.
      Parameters:
      outputFile - target AsciiDoc file
      totalEndpointCount - total number of endpoints found across all scanned controllers
      shadows - the endpoints not described in the OpenAPI documentation, excluding any matched by a configured exclusion rule - these are the endpoints that can fail failOnShadow
      excludedImplementations - every scanned endpoint matched by a configured exclusion rule (whether or not it is also undocumented) - a real implementation exists at a path declared excluded, which undermines the assumption behind the exclusion; rendered under == Excluded Implementations instead of == Shadow APIs, never fails the build, and never appears in contract history - when empty, no such section is written
      systemUnderTestVersion - version of the system under test that was scanned
      warnings - non-fatal configuration gaps to render as a WARNING admonition right after the report header - e.g. a configured rootDocument or controllerDirs entry that doesn't exist yet; when empty, no such admonition is written
      contractHistory - contract progress history to render as a == Progress Over Time section, keyed by fingerprint; when empty, no such section is written
      Throws:
      IOException - if the output file cannot be written