Imported OAS3 shows error

Hi,

I’m evaluating Swagger and Stoplight.

I created a very simple API in Swagger, and have exported it from Swagger in YAML format and imported it into Stoplight.

I get this error:

Parameter “ id ” is not used in the path

Following is the code it’s complaining about:

"put": {
    "tags": [
      "admins"
    ],
    "summary": "modifies a product",
    "description": "Updates an existing product in the system",
    "operationId": "updateProduct",
    "parameters": [
      {
        "name": "id",
        "in": "path",
        "description": "The product ID",
        "required": true,
        "style": "simple",
        "explode": false,
        "schema": {
          "minimum": 1,
          "type": "integer"
        }
      }
    ],
    "requestBody": {
      "description": "Product to add",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ModifyProduct"
          }
        }
      }
    },
    "responses": {
      "200": {
        "description": "product updated"
      },
      "400": {
        "description": "invalid input, object invalid"
      },
      "409": {
        "description": "your update would conflict with another product"
      }
    }
  },

What is the route this put is reporting to ?

Hi,

Thanks for your reply.

The route is “/product”.

Here’s the front part:

{
  "openapi": "3.0.0",
  "info": {
    "title": "Cooltrax Data Warehouse API",
    "description": "Cooltrax Data Warehouse",
    "contact": {
      "email": "russell.robinson@cooltrax.com"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://virtserver.swaggerhub.com/C181/cdw/1.0.0",
      "description": "SwaggerHub API Auto Mocking"
    },
    {
      "url": "https://virtserver.swaggerhub.com/C181/product/1.0.0",
      "description": "SwaggerHub API Auto Mocking"
    }
  ],
  "tags": [
    {
      "name": "admins",
      "description": "Secured Admin-only calls"
    },
    {
      "name": "developers",
      "description": "Operations available to regular developers"
    }
  ],
  "paths": {
    "/product": {

I guess it’s simply 'cause your product update “put” operation should be linked to route /product/{id} instead of /product

Here the “in” path parameter id is defined but not used in /product

Hi,

Thanks for your reply.

“in” is not a parameter. According to Swagger, this is the way to say that the parameter is “in the path”.

The YAML is:

parameters:
   - in: path
     name: id
     ...

So I’m guessing Stoplight doesn’t understand the OAS 3 YAML properly (or Swagger is doing something strange.)

Sorry I did not meant in was a parameter

“id” is the indeed the name of your path parameter

And thought it is defined, it’s not used in /product