Request Header Is Incompatible Value is incompatib...
# pactflow
a
Request Header Is Incompatible Value is incompatible with the parameter defined in the spec file: should have required property 'value' Mismatched Pact Path: [root].interactions[0] Mismatched Provider Path: [root].paths./**.post.parameters[0]
y
Hey, are you able to share your pact and spec at all?
Thanks buddy, here are the results you can see locally. Just for context, what are you seeing in your Pactflow broker, on each of the screens for your provider and consumer contract? Just wondering if there is enough detail as per the local output to help you diagnose. Will have a look through the errors now
npx @pactflow/swagger-mock-validator Matching.yaml CA.json
Copy code
❯ npx @pactflow/swagger-mock-validator Matching.yaml CA.json
Mock file "CA.json" is not compatible with spec file "Matching.yaml"
2 error(s)
	request.authorization.missing: 1
	request.header.incompatible: 1
0 warning(s)
{
  warnings: [],
  errors: [
    {
      code: 'request.authorization.missing',
      message: 'Request Authorization header is missing but is required by the spec file',
      mockDetails: {
        interactionDescription: 'A valid post response',
        interactionState: 'We have resposne from Ontology',
        location: '[root].interactions[0]',
        mockFile: 'CA.json',
        value: {
          description: 'A valid post response',
          providerState: 'We have resposne from Ontology',
          request: [Object],
          response: [Object]
        }
      },
      source: 'spec-mock-validation',
      specDetails: {
        location: '[root].security[0].apiKeyHeader',
        pathMethod: 'post',
        pathName: '/api/v1/ontology/normalizations',
        specFile: 'Matching.yaml',
        value: []
      },
      type: 'error'
    },
    {
      code: 'request.header.incompatible',
      message: "Value is incompatible with the parameter defined in the spec file: should have required property 'value'",
      mockDetails: {
        interactionDescription: 'A valid post response',
        interactionState: 'We have resposne from Ontology',
        location: '[root].interactions[0]',
        mockFile: 'CA.json',
        value: {
          description: 'A valid post response',
          providerState: 'We have resposne from Ontology',
          request: [Object],
          response: [Object]
        }
      },
      source: 'spec-mock-validation',
      specDetails: {
        location: '[root].paths./api/v1/ontology/normalizations.post.parameters[0]',
        pathMethod: 'post',
        pathName: '/api/v1/ontology/normalizations',
        specFile: 'Matching.yaml',
        value: {
          name: 'X-Tenant-ID',
          in: 'header',
          description: 'Internal Tenant ID',
          required: true,
          schema: [Object]
        }
      },
      type: 'error'
    }
  ]
}

Error: Mock file "CA.json" is not compatible with spec file "Matching.yaml"
a
Copy code
{
      code: 'request.header.incompatible',
      message: "Value is incompatible with the parameter defined in the spec file: should have required property 'value'",
      mockDetails: {
        interactionDescription: 'A valid post response',
        interactionState: 'We have resposne from Ontology',
        location: '[root].interactions[0]',
        mockFile: 'CA.json',
        value: {
          description: 'A valid post response',
          providerState: 'We have resposne from Ontology',
          request: [Object],
          response: [Object]
        }
i don't understate this part
y
Copy code
{
      code: 'request.header.incompatible',
      message: "Value is incompatible with the parameter defined in the spec file: should have required property 'value'",
      mockDetails: {
        interactionDescription: 'A valid post response',
        interactionState: 'We have resposne from Ontology',
        location: '[root].interactions[0]',
        mockFile: 'CA.json',
        value: {
          description: 'A valid post response',
          providerState: 'We have resposne from Ontology',
          request: [Object],
          response: [Object]
        }
      },
      source: 'spec-mock-validation',
      specDetails: {
        location: '[root].paths./api/v1/ontology/normalizations.post.parameters[0]',
        pathMethod: 'post',
        pathName: '/api/v1/ontology/normalizations',
        specFile: 'Matching.yaml',
        value: {
          name: 'X-Tenant-ID',
          in: 'header',
          description: 'Internal Tenant ID',
          required: true,
          schema: [Object]
        }
      },
      type: 'error'
    }
X-Tenant-ID
is required but not in your Pact file
The first error
Copy code
{
      code: 'request.authorization.missing',
      message: 'Request Authorization header is missing but is required by the spec file',
      mockDetails: {
        interactionDescription: 'A valid post response',
        interactionState: 'We have resposne from Ontology',
        location: '[root].interactions[0]',
        mockFile: 'CA.json',
        value: {
          description: 'A valid post response',
          providerState: 'We have resposne from Ontology',
          request: [Object],
          response: [Object]
        }
      },
      source: 'spec-mock-validation',
      specDetails: {
        location: '[root].security[0].apiKeyHeader',
        pathMethod: 'post',
        pathName: '/api/v1/ontology/normalizations',
        specFile: 'Matching.yaml',
        value: []
      },
      type: 'error'
    },
there are two `apiKeyHeader`'s defined in the spec
Copy code
securitySchemes:
    apiKeyHeader:
      type: apiKey
      name: Ocp-Apim-Subscription-Key
      in: header
    apiKeyQuery:
      type: apiKey
      name: subscription-key
      in: query
it is an error because
Ocp-Apim-Subscription-Key
is a defined header but is not present in the pact file
a
got it, thanks
i will fix it
🙂
y
🙌 Thanks for sharing the spec and pact file! Will look to improve our docs over time for failure diagnosing so it can be easy to help you all get on and fix things when they fail
👍 1