From a94e7edd47d0b94d7f27824fd20c696f492eb4e0 Mon Sep 17 00:00:00 2001
From: buildmaster spring.cloud.contract.verifier.assert.size. By default, this feature is set to false.
You can also provide the assertJsonSize property in the plugin configuration.
![]() | Warning |
|---|---|
Because JSON structure can have any form, it can be impossible to parse it
properly when using the |
The following sections describe the most common top-level elements:
The following sections describe the most common top-level elements:
You can add a description to your contract. The description is arbitrary text. The
following code shows an example:
org.springframework.cloud.contract.spec.Contract.make {
description('''
given:
@@ -77,17 +77,7 @@ multiple contracts, your autogenerated tests fail to compile and your generated
override each other.If you want to ignore a contract, you can either set a value of ignored contracts in the
plugin configuration or set the ignored property on the contract itself:
org.springframework.cloud.contract.spec.Contract.make {
ignored()
-}Starting with version 1.2.0, you can pass values from files. Assume that you have the
-following resources in our project.
└── src
- └── test
- └── resources
- └── contracts
- ├── readFromFile.groovy
- ├── request.json
- └── response.jsonFurther assume that your contract is as follows:
Unresolved directive in verifier_contract.adoc - include::../../../../spring-cloud-contract-verifier/src/test/resources/classpath/readFromFile.groovy[indent=0]Further assume that the JSON files is as follows:
request.json
Unresolved directive in verifier_contract.adoc - include::../../../../spring-cloud-contract-verifier/src/test/resources/classpath/request.json[indent=0]
response.json
Unresolved directive in verifier_contract.adoc - include::../../../../spring-cloud-contract-verifier/src/test/resources/classpath/response.json[indent=0]
When test or stub generation takes place, the contents of the file is passed to the body
-of a request or a response. That works because of the file(…) method. The argument of
-that method needs to be a file with location relative to the folder in which the contract
-lays.
The following methods can be called in the top-level closure of a contract definition. +}
The following methods can be called in the top-level closure of a contract definition.
request and response are mandatory. priority is optional.
org.springframework.cloud.contract.spec.Contract.make {
// Definition of HTTP request part of the contract
// (this can be a valid request or invalid depending
diff --git a/1.1.x/multi/multi_spring-cloud-contract.html b/1.1.x/multi/multi_spring-cloud-contract.html
index d82031d0c2..bd61e5c5a9 100644
--- a/1.1.x/multi/multi_spring-cloud-contract.html
+++ b/1.1.x/multi/multi_spring-cloud-contract.html
@@ -1,3 +1,3 @@
- Spring Cloud Contract Table of Contents
- 1. Spring Cloud Contract
- 2. Spring Cloud Contract Verifier Introduction
- 3. Spring Cloud Contract Verifier Setup
- 3.1. Gradle Project
- 3.1.1. Prerequisites
- 3.1.2. Add gradle plugin with dependencies
- 3.1.3. Gradle and Rest Assured 3.0
- 3.1.4. Snapshot versions for Gradle
- 3.1.5. Add stubs
- 3.1.6. Run plugin
- 3.1.7. Default setup
- 3.1.8. Configure plugin
- 3.1.9. Configuration options
- 3.1.10. Single base class for all tests
- 3.1.11. Different base classes for contracts
- 3.1.12. Invoking generated tests
- 3.1.13. Spring Cloud Contract Verifier on consumer side
- 3.2. Using in your Maven project
- 3.2.1. Add maven plugin
- 3.2.2. Maven and Rest Assured 3.0
- 3.2.3. Snapshot versions for Maven
- 3.2.4. Add stubs
- 3.2.5. Run plugin
- 3.2.6. Configure plugin
- 3.2.7. Important configuration options
- 3.2.8. Single base class for all tests
- 3.2.9. Different base classes for contracts
- 3.2.10. Invoking generated tests
- 3.2.11. FAQ with Maven Plugin
- 3.2.12. Maven Plugin and STS
- 3.2.13. Spring Cloud Contract Verifier on consumer side
- 3.3. Scenarios
- 3.4. Stubs and transitive dependencies
- 4. Spring Cloud Contract Verifier Messaging
- 5. Spring Cloud Contract Stub Runner
- 6. Stub Runner for Messaging
- 7. Contract DSL
- 8. Customization
- 9. Using the Pluggable Architecture
- 10. Spring Cloud Contract WireMock
- 11. Links
\ No newline at end of file
+ Spring Cloud Contract Table of Contents
- 1. Spring Cloud Contract
- 2. Spring Cloud Contract Verifier Introduction
- 3. Spring Cloud Contract Verifier Setup
- 3.1. Gradle Project
- 3.1.1. Prerequisites
- 3.1.2. Add gradle plugin with dependencies
- 3.1.3. Gradle and Rest Assured 3.0
- 3.1.4. Snapshot versions for Gradle
- 3.1.5. Add stubs
- 3.1.6. Run plugin
- 3.1.7. Default setup
- 3.1.8. Configure plugin
- 3.1.9. Configuration options
- 3.1.10. Single base class for all tests
- 3.1.11. Different base classes for contracts
- 3.1.12. Invoking generated tests
- 3.1.13. Spring Cloud Contract Verifier on consumer side
- 3.2. Using in your Maven project
- 3.2.1. Add maven plugin
- 3.2.2. Maven and Rest Assured 3.0
- 3.2.3. Snapshot versions for Maven
- 3.2.4. Add stubs
- 3.2.5. Run plugin
- 3.2.6. Configure plugin
- 3.2.7. Important configuration options
- 3.2.8. Single base class for all tests
- 3.2.9. Different base classes for contracts
- 3.2.10. Invoking generated tests
- 3.2.11. FAQ with Maven Plugin
- 3.2.12. Maven Plugin and STS
- 3.2.13. Spring Cloud Contract Verifier on consumer side
- 3.3. Scenarios
- 3.4. Stubs and transitive dependencies
- 4. Spring Cloud Contract Verifier Messaging
- 5. Spring Cloud Contract Stub Runner
- 6. Stub Runner for Messaging
- 7. Contract DSL
- 8. Customization
- 9. Using the Pluggable Architecture
- 10. Spring Cloud Contract WireMock
- 11. Links