Package com.arc_e_tect.gradle.mirage
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
- Additionally scan WireMock stubs:
false - WireMock stub directories:
src/test/resources/mappings(used only when scanning mocks) - WireMock stub source directories: the Java directories of every source set except
main(every test suite a project defines, not justtest), when thejavaplugin is applied (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
-
TASK_NAME
Name of the Gradle task registered by this plugin.- See Also:
-
MIGRATE_CONTRACT_HISTORY_TASK_NAME
Name of the contract history migration task registered by this plugin.- See Also:
-
-
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:
applyin interfaceorg.gradle.api.Plugin<org.gradle.api.Project>
-