pactpactflow

Getting Path or method not defined in PactFlow


After publishing the consumer contract, I am seeing the below error in PactFlow

Path or method not defined in spec file: GET /api/v1/Cards/2498678462560/usage-restrictions

[root].interactions[0].request.path = "/api/v1/Cards/2498678462560/usage-restrictions"

But when I check my providerAPI json I can see following:

{
    "openapi": "3.0.1",
    "info": {
        "title": "Core.IApi.Cards.Api",
        "version": "1.0"
    },
    "paths": {
        "/api/v{version}/Cards/{tokenisedPan}/usage-restrictions": {
            "get": {
                "tags": [
                    "Cards"
                ],
                "summary": "Retrieves usage restrictions associated with a specific tokenised PAN (Primary Account Number).",
                "parameters": [
                    {
                        "name": "tokenisedPan",
                        "in": "path",
                        "description": "The tokenised PAN for which to fetch usage restrictions.",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "format": "int64"

What could be the issue? Why consumer contract endpoint is not matching with Provider OpenAPI spec?


Solution

  • I don't believe variable matching in this way is supported: v{version}.

    You should use {version} instead, which incorporates the v and the number.