Class MirageApiDetectorPlugin

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

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

Usage

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

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

Defaults

  • Controller directories: src/main/java
  • OpenAPI description directory: the root document's own parent directory
  • Scan mocks instead of controllers: false
  • WireMock stub directories: src/test/resources/mappings (used only when scanning mocks)
  • Fail on mirage APIs: false
  • Report directory: build/reports/mirage-api-detector
  • Report file name: mirage-apis.adoc
  • Track contract history: false
  • Contract history file: mirage-api-detector-contract-history.ndjson (project directory)
  • Update contract history: same as track contract history

The task is not wired into check or build automatically - teams that write their OpenAPI documentation ahead of the implementation would otherwise see every build fail on endpoints that simply have not been built yet. Opt in explicitly once the task is safe to run as part of your build:

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

  • Constructor Details

    • MirageApiDetectorPlugin

      public MirageApiDetectorPlugin()
      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>