Giter Site home page Giter Site logo

Comments (4)

bethesque avatar bethesque commented on June 19, 2024 1

Yup.

"path": {
      "json_class": "Pact::Term",
      "data": {
        "generate": "/alligators/1234",
        "matcher": {"json_class":"Regexp","o":0,"s":"^\\/alligators\\/[0-9]{4}"}
      }
    }

This code says: when I verify the request on the provider side, I want to use the path /alligators/1234, but in my consumer code, I want the mock service to respond to a request for any alligator with this response.

from pact-mock_service.

bethesque avatar bethesque commented on June 19, 2024

Yup, that's because it's not needed on the provider side. You need a concrete path when verifying on the provider side. The matcher is only relevant for the consumer side matching.

from pact-mock_service.

andrewspinks avatar andrewspinks commented on June 19, 2024

OK, thanks for the clarification Beth. Let me go back to trying to understand the use case for using a path matcher...

from pact-mock_service.

mefellows avatar mefellows commented on June 19, 2024

For posterity, as I understand it, the path matcher is useful on the consumer side where dynamic values might be created from the collaborating client code, perhaps without control over the resources it wants to access e.g. GET /users/1234 or GET /articles/<todays date> etc. As Beth explains, this is only relevant on the consumer side and thus is not required to be in the pact file itself.

from pact-mock_service.

Related Issues (20)

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.