diff --git a/2.1.x/multi/multi__customization.html b/2.1.x/multi/multi__customization.html index 3bcaae3da0..3a73c2dbf4 100644 --- a/2.1.x/multi/multi__customization.html +++ b/2.1.x/multi/multi__customization.html @@ -1,9 +1,9 @@
-![]() | Important |
|---|---|
This section is valid only for Groovy DSL |
You can customize the Spring Cloud Contract Verifier by extending the DSL, as shown in -the remainder of this section.
You can provide your own functions to the DSL. The key requirement for this feature is to +
![]() | Important |
|---|---|
This section is valid only for Groovy DSL |
You can customize the Spring Cloud Contract Verifier by extending the DSL, as shown in +the remainder of this section.
You can provide your own functions to the DSL. The key requirement for this feature is to maintain the static compatibility. Later in this document, you can see examples of:
You can find the full example -here.
The following examples show three classes that can be reused in the DSLs.
PatternUtils contains functions used by both the consumer and the producer.
package com.example; +here.The following examples show three classes that can be reused in the DSLs.
PatternUtils contains functions used by both the consumer and the producer.
package com.example; import java.util.regex.Pattern; @@ -134,8 +134,8 @@ maintain the static compatibility. Later in this document, you can see examples return new ServerDslProperty( PatternUtils.ok(), "OK"); } } -//end::impl[]In order for the plugins and IDE to be able to reference the common JAR classes, you need -to pass the dependency to your project.
First, add the common jar dependency as a test dependency. Because your contracts files +//end::impl[]
In order for the plugins and IDE to be able to reference the common JAR classes, you need +to pass the dependency to your project.
First, add the common jar dependency as a test dependency. Because your contracts files are available on the test resources path, the common jar classes automatically become visible in your Groovy files. The following examples show how to test the dependency:
Maven.
<dependency> @@ -146,7 +146,7 @@ visible in your Groovy files. The following examples show how to test the depend </dependency>
Gradle.
testCompile("com.example:beer-common:0.0.1.BUILD-SNAPSHOT")-
Now, you must add the dependency for the plugin to reuse at runtime, as shown in the +
Now, you must add the dependency for the plugin to reuse at runtime, as shown in the following example:
Maven.
<plugin> <groupId>org.springframework.cloud</groupId> @@ -173,7 +173,7 @@ following example:Maven. </plugin>
Gradle.
classpath "com.example:beer-common:0.0.1.BUILD-SNAPSHOT"-
You can now reference your classes in your DSL, as shown in the following example:
package contracts.beer.rest +You can now reference your classes in your DSL, as shown in the following example:
package contracts.beer.rest import com.example.ConsumerUtils import com.example.ProducerUtils @@ -214,4 +214,4 @@ then: contentType(applicationJson()) } } -}
Important You can set the Spring Cloud Contract plugin up by setting
convertToYamltotrue. That way you will NOT have to add the dependency with the extended functionality to the consumer side, since the consumer side will be using YAML contracts instead of Groovy ones.
![]() | Important |
|---|---|
You can set the Spring Cloud Contract plugin up by setting |