Class DoppelgangerApiDetectorPlugin

java.lang.Object
com.arc_e_tect.gradle.doppelganger.DoppelgangerApiDetectorPlugin
All Implemented Interfaces:
org.gradle.api.Plugin<org.gradle.api.Project>

public class DoppelgangerApiDetectorPlugin extends Object implements org.gradle.api.Plugin<org.gradle.api.Project>
Gradle plugin that registers the detectDoppelgangerApis task and wires the doppelgangerApiDetector DSL extension into the project.

Usage

 plugins {
     id 'com.arc-e-tect.doppelganger-api-detector'
 }

 doppelgangerApiDetector {
     rootDocument = file('src/main/resources/openapi/openapi.yaml')
 }
 

Defaults

  • Controller directories: src/main/java
  • Test directories: src/test/java
  • OpenAPI description directory: the root document's own parent directory
  • Contracts directory: src/test/resources/contracts
  • Contract verification sources: Spring RestDocs, OpenAPI request validator, and Spring Cloud Contract, all enabled
  • Fail on doppelganger APIs: false
  • Report directory: build/reports/doppelganger-api-detector
  • Report file name: doppelganger-apis.adoc

The task is not wired into check or build automatically - teams generating their OpenAPI documentation from code, or migrating their tests onto one of the supported verification mechanisms gradually, would otherwise see every build fail immediately. Opt in explicitly once the task is safe to run as part of your build:

 tasks.named('check') {
     dependsOn 'detectDoppelgangerApis'
 }
 
  • Field Details

  • Constructor Details

    • DoppelgangerApiDetectorPlugin

      public DoppelgangerApiDetectorPlugin()
      Creates a new plugin instance. Instantiated by Gradle infrastructure.
  • Method Details

    • apply

      public void apply(org.gradle.api.Project project)
      Specified by:
      apply in interface org.gradle.api.Plugin<org.gradle.api.Project>