pact-foundation / pact-specification

Describes the pact format and verification specifications
MIT License
295 stars 28 forks source link

Combine message and rest interactions in the same file #79

Closed uglyog closed 2 years ago

uglyog commented 4 years ago

There has been a few requests to be able to store different types of interactions in the same pact file.

There are two main ways these could be stored:

Interactions keyed by type

The interactions section could be changed to something like:

{
  "interactions": {
    "request/response": [ ... ],
    "message": [ ... ],
    ...
  }
}

Interactions with a type attribute

This model is preferred by people who use serialising frameworks (usually based on annotations) because it is easy to model with polymorphism. So this would be:

{
    "interactions": [
        {
            "type": "request/response",
            ...
        },
       ...
    ]
}
uglyog commented 4 years ago

Decision is to go with interactions with a type attribute, as this makes it easier to add new types of interactions in the future