Struct pact_models::message_pact::MessagePact
source · pub struct MessagePact {
pub consumer: Consumer,
pub provider: Provider,
pub messages: Vec<Message>,
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.
It contains a list of Messages instead of Interactions, but is otherwise
identical to struct Pact
.
Fields§
§consumer: Consumer
Consumer side of the pact
provider: Provider
Provider side of the pact
messages: Vec<Message>
List of messages 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§
source§impl MessagePact
impl MessagePact
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<MessagePact>
pub fn from_json(file: &str, pact_json: &Value) -> Result<MessagePact>
Creates a MessagePact
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 default_file_name(&self) -> String
pub fn default_file_name(&self) -> String
Determines the default file name for the pact. This is based on the consumer and provider names.
sourcepub fn from_url(url: &String, auth: &Option<HttpAuth>) -> Result<MessagePact>
pub fn from_url(url: &String, auth: &Option<HttpAuth>) -> Result<MessagePact>
Reads the pact file from a URL and parses the resulting JSON
into a MessagePact
struct
sourcepub fn overwrite_pact(
&self,
path: &Path,
pact_spec: PactSpecification
) -> Result<()>
pub fn overwrite_pact( &self, path: &Path, pact_spec: PactSpecification ) -> Result<()>
Writes this pact out to the provided file path. All directories in the path will automatically created. If there is already a file at the path, it will be overwritten.
sourcepub fn default() -> MessagePact
pub fn default() -> MessagePact
Returns a default MessagePact struct
Trait Implementations§
source§impl Clone for MessagePact
impl Clone for MessagePact
source§fn clone(&self) -> MessagePact
fn clone(&self) -> MessagePact
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MessagePact
impl Debug for MessagePact
source§impl Pact for MessagePact
impl Pact for MessagePact
source§fn to_json(&self, pact_spec: PactSpecification) -> Result<Value>
fn to_json(&self, pact_spec: PactSpecification) -> Result<Value>
Converts this pact to a Value
struct.
source§fn interactions(
&self
) -> Vec<Box<dyn Interaction + Send + Sync + RefUnwindSafe>>
fn interactions( &self ) -> Vec<Box<dyn Interaction + Send + Sync + RefUnwindSafe>>
source§fn interactions_mut(&mut self) -> Vec<&mut (dyn Interaction + Send + Sync)>
fn interactions_mut(&mut self) -> Vec<&mut (dyn Interaction + Send + Sync)>
source§fn as_request_response_pact(&self) -> Result<RequestResponsePact>
fn as_request_response_pact(&self) -> Result<RequestResponsePact>
source§fn as_message_pact(&self) -> Result<MessagePact>
fn as_message_pact(&self) -> Result<MessagePact>
source§fn as_v4_pact(&self) -> Result<V4Pact>
fn as_v4_pact(&self) -> Result<V4Pact>
source§fn specification_version(&self) -> PactSpecification
fn specification_version(&self) -> PactSpecification
source§fn boxed(&self) -> Box<dyn Pact + Send + Sync + RefUnwindSafe>
fn boxed(&self) -> Box<dyn Pact + Send + Sync + RefUnwindSafe>
source§fn arced(&self) -> Arc<dyn Pact + Send + Sync + RefUnwindSafe>
fn arced(&self) -> Arc<dyn Pact + Send + Sync + RefUnwindSafe>
source§fn thread_safe(&self) -> Arc<Mutex<dyn Pact + Send + Sync + RefUnwindSafe>>
fn thread_safe(&self) -> Arc<Mutex<dyn Pact + Send + Sync + RefUnwindSafe>>
source§fn add_interaction(&mut self, interaction: &dyn Interaction) -> Result<()>
fn add_interaction(&mut self, interaction: &dyn Interaction) -> Result<()>
source§fn requires_plugins(&self) -> bool
fn requires_plugins(&self) -> bool
source§fn plugin_data(&self) -> Vec<PluginData>
fn plugin_data(&self) -> Vec<PluginData>
source§fn 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<()>
source§fn add_md_version(&mut self, key: &str, version: &str)
fn add_md_version(&mut self, key: &str, version: &str)
source§impl PactJsonVerifier for MessagePact
impl PactJsonVerifier for MessagePact
source§fn verify_json(
path: &str,
pact_json: &Value,
_strict: bool,
_spec_version: PactSpecification
) -> Vec<PactFileVerificationResult>
fn verify_json( path: &str, pact_json: &Value, _strict: bool, _spec_version: PactSpecification ) -> Vec<PactFileVerificationResult>
source§impl PartialEq for MessagePact
impl PartialEq for MessagePact
source§fn eq(&self, other: &MessagePact) -> bool
fn eq(&self, other: &MessagePact) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl ReadWritePact for MessagePact
impl ReadWritePact for MessagePact
source§fn read_pact(path: &Path) -> Result<MessagePact>
fn read_pact(path: &Path) -> Result<MessagePact>
Pact
structsource§fn merge(
&self,
pact: &dyn Pact
) -> Result<Box<dyn Pact + Send + Sync + RefUnwindSafe>>
fn merge( &self, pact: &dyn Pact ) -> Result<Box<dyn Pact + Send + Sync + RefUnwindSafe>>
source§fn default_file_name(&self) -> String
fn default_file_name(&self) -> String
impl StructuralPartialEq for MessagePact
Auto Trait Implementations§
impl Freeze for MessagePact
impl RefUnwindSafe for MessagePact
impl Send for MessagePact
impl Sync for MessagePact
impl Unpin for MessagePact
impl UnwindSafe for MessagePact
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more