Hi all, it seems that I have gotten the above erro...
# pactflow
n
Hi all, it seems that I have gotten the above error once again. This time i've reviewed and cannot see why pactflow is labelling the consumer and provider as compatible when they should not be. From the images attached you can see that the consumer expects and
id
but the provider does not provide one. Why is pact able to label this as compatible?
👀 1
Also, as you can see from this image, it says, "Compared at: a day ago" but I have released several versions of the provider just a few minutes ago.
b
I can't tell from these screenshots what the matchers in the contract are, or what is actually being returned. Probably need to look at the consumer-side test, and the logs of the provider verification.
(I'm not really familiar with the Pactflow UI, and the other screenshots look like Swagger? They all look like example payloads, rather than anything Pact would assert against)
n
I was under the impression as per the docs on pactflow that it should confirm that the consumer is a subset of the provider. But in this case even without seeing any more info isn't it breaking that rule, we can see that the consumer says it needs an id but the provider is not giving it an id.
b
Oh, you're doing bi-directional contract testing? I don't know much about that either.
n
Haha yes i'm doing bidirectional. Okay no worries thanks for looking into though.
c
Hi Noor, are you able to see the more recent verification results in the matrix page for this integration? Wondering if this could be an issue with the overview page.
n
Yep I see them there and they are also failing. Could this be an issue with content type? In my open api we have content set as
application/vnd.api+json
but in the example here they have it set as
application/json
. I tried changing it and I can see that now it seems to work but the issue with this is that all of our openapi files are using
application/vnd.api+json
. There are hundreds of places where the
application/vnd.api+json
is used and would be very difficult to replace it. Is there any other way to allow pactflow to be able to read this content format?
c
so in both your pact file and oas you are setting the content type as
application/vnd.api+json
? I believe in theory that should work with this content type, so this seems to point to an issue with comparison code. I can't think of another work around but will look into it more
Are you able to share the actual error message as it appears in the pactflow UI? I created this example using
application/vnd.api+json
, where the pact file is expecting the response to have that type, and the OAS dictates that it can produce that type. I'm not sure if this is the same use case that you are working on? pact
Copy code
{
  "consumer": {
    "name": "default-consumer-name"
  },
  "interactions": [
    {
      "description": "interaction description",
      "request": {
        "method": "post",
        "path": "/does/exist"
      },
      "response": {
        "status": 200,
        "headers": {
          "Content-Type": "application/vnd.api+json"
        }
      }
    }
  ],
  "metadata": {
    "pactSpecification": {
      "version": "1.0.0"
    }
  },
  "provider": {
    "name": "default-provider-name"
  }
}
OAS
Copy code
{
  "info": {
    "title": "default-title",
    "version": "1.0.0"
  },
  "paths": {
    "/does/exist": {
      "post": {
        "responses": {
          "200": {
            "description": "default-response"
          }
        },
        "produces": [
          "application/vnd.api+json"
        ]
      }
    }
  },
  "swagger": "2.0"
}
Just to clarify, the overview page is showing an outdated validation, but on the matrix one you can see the most up to date validation result (which is failing as expected?)
only asking to check that there are 2 seperate issues you are experiencing so I can troubleshoot both
y
Hey @Noor Hashem can you provide your OAS and Pact file please?
n
Thank you @Yousaf Nabi (pactflow.io) and @Candy Goodison for the investigation on this! Much appreciated.
y
Think we’ve figured out the issue with a repro documented here https://github.com/pactflow/swagger-mock-validator/issues/12
🎉 2