Giter Site home page Giter Site logo

mattersight / pact-net-messages Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 5.0 1.87 MB

Pact.Net v3 implementation of message only for services that communicate via event streams and message queues

License: MIT License

C# 97.15% Batchfile 0.04% PowerShell 2.80%

pact-net-messages's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pact-net-messages's Issues

Question: How do I get "matchingRules" in a consumer Pact file?

I wrote a test to generate a consumer Pact file. Unfortunately the "matchingRules" are missing and I have no idea how to integrate them? Could someone give me a hint?

Here an example of what I miss:

...
  "messages": {
      "description": "ThingUpdatedEvent",
      "metaData": {
        "type": "ThinkUpdated"
      },
      "contents": {
          "id": "some id",
          "updatedAt": "20190114T12111869Z",
      },
      "providerStates": [
        {
          "name": "a thing was updated"
        }
      ],
      "matchingRules": {
          "body": {
            "$.id": {
              "matchers": [
                {
                   "match": "type"
                }
              ],
             "combine": "AND"
           },
           "$.updatedAt": {
              "matchers": [
              {
                  "match": "regex",
                  "regex": "\\d{8}T\\d{6,9}Z"
              }
            ],
            "combine": "AND"
          }
        }
      }
...

PactNetMessage support PactNet 2

is there any chance we have PactnetMessage to support PactNet 2 so we can utilise its features such as publishing provider verification result, can-i-deploy, ...

Support correct pact specification version format

Currently the following pact-specification-version-format is used:
"pactSpecificationVersion": "3.0.0"

According to this thread "pact-foundation/pact-jvm#917", the following format should be used by all Pact libraries:
"pactSpecification": { "version": "3.0.0" }
Is it possible to support the right format?

Background info:
We are currently in the situation that we have a consumer in .NET and a provider in Java which is using the "pact-jvm" library. The provider is not accepting the consumer pact because it uses the wrong "pact-specification-version-format". And according to the linked thread there seems to be an agreement to support only the above format.

Pact format for regex matcher is not recognized by provider verification test

The pact format generated by pact-net-message library looks like below. The matcher format generated is not recognized as matcher by the verfiication and keeps giving me error as Path $.Property1.json_class, expected: Pact::Term, actual:

{
  "provider": {
    "name": "test-provider-amqp"
  },
  "consumer": {
    "name": "test-consumer-amqp"
  },
  "messages": [
    {
      "description": "Verify the payload contract is satisfied",
      "providerState": "Pay load",
      "contents": {
        "EventName": "test.message",
        "Property1": {
          "json_class": "Pact::Term",
          "data": {
            "generate": "83F9262F-28F1-4703-AB1A-8CFD9E8249C9",
            "matcher": {
              "json_class": "Regexp",
              "o": 0,
              "s": "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
            }
          }
        }
      },
      "metaData": {
        "routingKey": "test.message"
      }
    }
  ],
  "metadata": {
    "pactSpecificationVersion": "3.0"
  }
}

Here's the pact generation code:

           var guidRegex = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}";
            var eventName = "test.message";
            var guid = "83F9262F-28F1-4703-AB1A-8CFD9E8249C9";

            dynamic eventData = new
            {
                EventName = eventName,
                Property1 = Match.Regex(guid, guidRegex)
            };

            amqpProvider.PactMessageBuilder.MockMq().Given("Pay load")
                .UponReceiving("Verify the payload contract is satisfied")
                .WithMetaData(new { routingKey = "test.message" })
                .WithContent(eventData);

Pact broker support

it is stated that

Pact Broker does not handle v3 specifications yet

What exactly is the problem?
How to track the status of it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.