Modeling PUT with path parameters for assertion testing


(Nir) #1

Hi there!

I have a path modeled with a paramter (see below for full schema - we can ignore the object model)

  • when going to the scenario testing - I have to pass the path paramter as part of the path so I use:

PUT https://xxx/v1/applications/{$.ctx.uuid}

which fails the matching for the contract testing (because now it has a path parameter) which makes me get the following error message:

PUT https://xxxx/v1/applications/${.ctx.uuid} did NOT match any operations in the connected OAS2 specifications.

There is a “query” tab in the input stage - however, no “path parameter” tab - what is the correct way to input the path parameter so that the scenario module can find the appropriate path spec and then do the correct contract testing?

  "put": {
    "responses": {
      "200": {
        "description": "",
        "schema": {
          "type": "object",
          "properties": {}
        }
      }
    },
    "summary": "Update application",
    "description": "Update an application with partial information",
    "operationId": "PUT-application",
    "tags": [
      "Applications"
    ],
    "parameters": [
      {
        "in": "body",
        "name": "body",
        "schema": {
          "$ref": "./Partner API Models.oas2.yml#/definitions/lead"
        }
      },
      {
        "in": "path",
        "name": "uuid",
        "type": "string",
        "required": true
      }
    ]
  }

(Thomas Pytleski) #2

Hi @nirsoffer!

Sorry for the delay, but correct me if I am wrong, it sounds like contract testing isn’t being run because it can’t find the operation in your specification?

If so, your request path looks correct, so there is something else going on. Your specification could be failing to load because it might be invalid, $.ctx.uuid could be undefined, maybe the basepath isn’t set in your specification, ect…

With that said, if you are still running into the issue could you email support@stoplight.io with a little bit more information. A link to your project in stoplight and the actual json from running the scenario. To get the result open up the developer console in the browser, and copy the response.

Thanks,

@bear


(Prabhum) #3

Hey @nirsoffer.

Was this resolved? I’m facing a similar issue.