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 and
updateDoppelgangerApiDetectorDSL tasks 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/testContract/java - OpenAPI description directory: the root document's own parent directory
- Contracts directory: no default - required when
useSpringCloudContractis enabled - Contract verification sources: Spring RestDocs enabled; OpenAPI request validator and Spring Cloud Contract opt-in
- Fail on doppelganger APIs:
false - Report directory:
build/reports/doppelganger-api-detector - Report file name:
doppelganger-apis.adoc - Track contract history:
false - Contract history file:
doppelganger-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 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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the contract-coverage-scanning Gradle task registered by this plugin.static final StringName of the doppelganger-detection Gradle task registered by this plugin.static final StringName of the DSL-updating task registered by this plugin. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
TASK_NAME
Name of the doppelganger-detection Gradle task registered by this plugin.- See Also:
-
SCAN_CONTRACTS_TASK_NAME
Name of the contract-coverage-scanning Gradle task registered by this plugin.- See Also:
-
UPDATE_DSL_TASK_NAME
Name of the DSL-updating task registered by this plugin.- See Also:
-
-
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:
applyin interfaceorg.gradle.api.Plugin<org.gradle.api.Project>
-