Struct pact_matching::models::Pact [−][src]
pub struct Pact { pub consumer: Consumer, pub provider: Provider, pub interactions: Vec<Interaction>, pub metadata: BTreeMap<String, BTreeMap<String, String>>, pub specification_version: PactSpecification, }
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<Interaction>
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
Methods
impl Pact
[src]
impl Pact
pub fn spec_version(&self) -> PactSpecification
[src]
pub fn spec_version(&self) -> PactSpecification
Returns the specification version of this pact
pub fn from_json(file: &String, pact_json: &Value) -> Pact
[src]
pub fn from_json(file: &String, pact_json: &Value) -> Pact
Creates a Pact
from a Value
struct.
pub fn to_json(&self, pact_spec: PactSpecification) -> Value
[src]
pub fn to_json(&self, pact_spec: PactSpecification) -> Value
Converts this pact to a Value
struct.
pub fn metadata_to_json(
&self,
pact_spec: &PactSpecification
) -> BTreeMap<String, Value>
[src]
pub fn metadata_to_json(
&self,
pact_spec: &PactSpecification
) -> BTreeMap<String, Value>
Creates a BTreeMap of the metadata of this pact.
pub fn merge(&self, pact: &Pact) -> Result<Pact, String>
[src]
pub fn merge(&self, pact: &Pact) -> Result<Pact, String>
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 any interaction has the same description and provider state and the requests and responses are different.
pub fn default_file_name(&self) -> String
[src]
pub fn default_file_name(&self) -> String
Determins the default file name for the pact. This is based on the consumer and provider names.
pub fn read_pact(file: &Path) -> Result<Pact>
[src]
pub fn read_pact(file: &Path) -> Result<Pact>
Reads the pact file and parses the resulting JSON into a Pact
struct
pub fn from_url(url: &String) -> Result<Pact, String>
[src]
pub fn from_url(url: &String) -> Result<Pact, String>
Reads the pact file from a URL and parses the resulting JSON into a Pact
struct
pub fn write_pact(
&self,
path: &Path,
pact_spec: PactSpecification
) -> Result<()>
[src]
pub fn write_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 an existing pact is found at the path, this pact will be merged into the pact file.
pub fn default() -> Pact
[src]
pub fn default() -> Pact
Returns a default Pact struct
Trait Implementations
impl Debug for Pact
[src]
impl Debug for Pact
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Pact
[src]
impl Clone for Pact