Struct pact_models::sync_pact::RequestResponsePact
source · [−]pub struct RequestResponsePact {
pub consumer: Consumer,
pub provider: Provider,
pub interactions: Vec<RequestResponseInteraction>,
pub metadata: BTreeMap<String, BTreeMap<String, String>>,
pub specification_version: PactSpecification,
}
Expand description
Struct that represents a pact between the consumer and provider of a service.
Fields
consumer: Consumer
Consumer side of the pact
provider: Provider
Provider side of the pact
interactions: Vec<RequestResponseInteraction>
List of interactions between the consumer and provider.
metadata: BTreeMap<String, BTreeMap<String, String>>
Metadata associated with this pact file.
specification_version: PactSpecification
Specification version of this pact
Implementations
sourceimpl RequestResponsePact
impl RequestResponsePact
sourcepub fn spec_version(&self) -> PactSpecification
pub fn spec_version(&self) -> PactSpecification
Returns the specification version of this pact
sourcepub fn from_json(file: &str, pact_json: &Value) -> Result<RequestResponsePact>
pub fn from_json(file: &str, pact_json: &Value) -> Result<RequestResponsePact>
Creates a Pact
from a Value
struct.
sourcepub fn metadata_to_json(
&self,
pact_spec: &PactSpecification
) -> BTreeMap<String, Value>
pub fn metadata_to_json(
&self,
pact_spec: &PactSpecification
) -> BTreeMap<String, Value>
Creates a BTreeMap of the metadata of this pact.
sourcepub fn from_url(
url: &str,
auth: &Option<HttpAuth>
) -> Result<RequestResponsePact>
pub fn from_url(
url: &str,
auth: &Option<HttpAuth>
) -> Result<RequestResponsePact>
Reads the pact file from a URL and parses the resulting JSON into a Pact
struct
sourcepub fn default() -> RequestResponsePact
pub fn default() -> RequestResponsePact
Returns a default RequestResponsePact struct
sourcepub fn default_metadata() -> BTreeMap<String, BTreeMap<String, String>>
pub fn default_metadata() -> BTreeMap<String, BTreeMap<String, String>>
Returns the default metadata
sourcepub fn schema(spec_version: PactSpecification) -> Value
pub fn schema(spec_version: PactSpecification) -> Value
Generate the JSON schema properties for the given Pact specification
Trait Implementations
sourceimpl Clone for RequestResponsePact
impl Clone for RequestResponsePact
sourcefn clone(&self) -> RequestResponsePact
fn clone(&self) -> RequestResponsePact
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for RequestResponsePact
impl Debug for RequestResponsePact
sourceimpl Default for RequestResponsePact
impl Default for RequestResponsePact
sourcefn default() -> RequestResponsePact
fn default() -> RequestResponsePact
Returns the “default value” for a type. Read more
sourceimpl Pact for RequestResponsePact
impl Pact for RequestResponsePact
sourcefn to_json(&self, pact_spec: PactSpecification) -> Result<Value>
fn to_json(&self, pact_spec: PactSpecification) -> Result<Value>
Converts this pact to a Value
struct.
sourcefn interactions(&self) -> Vec<Box<dyn Interaction + Send + Sync>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn interactions(&self) -> Vec<Box<dyn Interaction + Send + Sync>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Interactions in the Pact
sourcefn interactions_mut(&mut self) -> Vec<&mut (dyn Interaction + Send + Sync)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn interactions_mut(&mut self) -> Vec<&mut (dyn Interaction + Send + Sync)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Mutable collection of interactions in the Pact
sourcefn as_request_response_pact(&self) -> Result<RequestResponsePact>
fn as_request_response_pact(&self) -> Result<RequestResponsePact>
Attempt to downcast to a concrete Pact
sourcefn as_message_pact(&self) -> Result<MessagePact>
fn as_message_pact(&self) -> Result<MessagePact>
Attempt to downcast to a concrete Message Pact
sourcefn as_v4_pact(&self) -> Result<V4Pact>
fn as_v4_pact(&self) -> Result<V4Pact>
Attempt to downcast to a concrete V4 Pact
sourcefn specification_version(&self) -> PactSpecification
fn specification_version(&self) -> PactSpecification
Specification version of this Pact
sourcefn thread_safe(&self) -> Arc<Mutex<dyn Pact + Send + Sync>>
fn thread_safe(&self) -> Arc<Mutex<dyn Pact + Send + Sync>>
Clones this Pact and wraps it in an Arc and Mutex
sourcefn add_interaction(&mut self, interaction: &dyn Interaction) -> Result<()>
fn add_interaction(&mut self, interaction: &dyn Interaction) -> Result<()>
Adds an interactions in the Pact
sourcefn requires_plugins(&self) -> bool
fn requires_plugins(&self) -> bool
If this Pact needs any plugins loaded
sourcefn plugin_data(&self) -> Vec<PluginData>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn plugin_data(&self) -> Vec<PluginData>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Plugins required for this Pact. These will be taken from the ‘plugins’ key in the pact metadata. Read more
sourcefn add_plugin(
&mut self,
_name: &str,
_version: &str,
_plugin_data: Option<HashMap<String, Value>>
) -> Result<()>
fn add_plugin(
&mut self,
_name: &str,
_version: &str,
_plugin_data: Option<HashMap<String, Value>>
) -> Result<()>
Add the plugin and plugin data to this Pact. If an entry already exists for the plugin, the plugin data will be merged Read more
sourcefn add_md_version(&mut self, key: &str, version: &str)
fn add_md_version(&mut self, key: &str, version: &str)
Adds some version info to the Pact-Rust metadata section
sourceimpl PactJsonVerifier for RequestResponsePact
impl PactJsonVerifier for RequestResponsePact
sourcefn verify_json(
_path: &str,
pact_json: &Value,
strict: bool,
spec_version: PactSpecification
) -> Vec<PactFileVerificationResult>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn verify_json(
_path: &str,
pact_json: &Value,
strict: bool,
spec_version: PactSpecification
) -> Vec<PactFileVerificationResult>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Verify the JSON format. Will return an error if the list contains any Error result
sourceimpl PartialEq<RequestResponsePact> for RequestResponsePact
impl PartialEq<RequestResponsePact> for RequestResponsePact
sourcefn eq(&self, other: &RequestResponsePact) -> bool
fn eq(&self, other: &RequestResponsePact) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &RequestResponsePact) -> bool
fn ne(&self, other: &RequestResponsePact) -> bool
This method tests for !=
.
sourceimpl ReadWritePact for RequestResponsePact
impl ReadWritePact for RequestResponsePact
sourcefn read_pact(path: &Path) -> Result<RequestResponsePact>
fn read_pact(path: &Path) -> Result<RequestResponsePact>
Reads the pact file and parses the resulting JSON into a Pact
struct
sourcefn merge(&self, pact: &dyn Pact) -> Result<Box<dyn Pact + Send + Sync>>
fn merge(&self, pact: &dyn Pact) -> Result<Box<dyn Pact + Send + Sync>>
Merges this pact with the other pact, and returns a new Pact with the interactions sorted. Returns an error if there is a merge conflict, which will occur if the other pact is a different type, or if a V3 Pact then if any interaction has the same description and provider state and the requests and responses are different. Read more
sourcefn default_file_name(&self) -> String
fn default_file_name(&self) -> String
Determines the default file name for the pact. This is based on the consumer and provider names. Read more
impl StructuralPartialEq for RequestResponsePact
Auto Trait Implementations
impl RefUnwindSafe for RequestResponsePact
impl Send for RequestResponsePact
impl Sync for RequestResponsePact
impl Unpin for RequestResponsePact
impl UnwindSafe for RequestResponsePact
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more