Repository: stoplightio/spectral (ts)

Issue:
Path Params being applied to more than http operations
**Describe the bug**
the `path-params` rule is being applied to more than just http operations defined under a path.

**To Reproduce**

```
openapi: 3.0.1
paths:
  /hello/{id}:
    x-dont-path-param-me: hello
    get:
      tags:
        - metadata
      operationId: list-data-sets
      summary: List available data sets
      responses:
        '200':
          description: Returns a list of data sets
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
```

output:
```
  1:1  warning  info-contact           Info object should contain `contact` object.
  1:1  warning  info-description       OpenAPI object info `description` must be present and non-empty string.
  1:1  warning  oas3-api-servers       OpenAPI `servers` must be present and non-empty array.
  1:1    error  oas3-schema            Object should have required property `info`.
  1:1  warning  openapi-tags           OpenAPI object should have non-empty `tags` array.
 4:27    error  path-params            The operation does not define the parameter `{id}` expected by path `/hello/{id}`.
  5:9  warning  operation-description  Operation `description` must be present and non-empty string.
 7:11  warning  operation-tag-defined  Operation tags should be defined in global tags.
```

you can see here that the path params rule is being applied to `x-dont-path-param-me`

**Expected behavior**
I expect it to only be applied to the standard http operations (get, post, put, delete, options, etc)

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Environment (remove any that are not applicable):**
 - Library version: 5.4.0
 - OS: MacOS 10.15.3


Pull request description:
fix: check against valid operations before checking parameters exist.
Fixes #1187.

**Checklist**

- [X] Tests added / updated
- [x] Docs added / updated

**Does this PR introduce a breaking change?**

- [ ] Yes
- [x] No

> If indicated yes above, please describe the breaking change(s).
>
> **Remove this quote before creating the PR.**

**Screenshots**

If applicable, add screenshots or gifs to help demonstrate the changes. If not applicable, remove this screenshots section before creating the PR.

**Additional context**

Add any other context about the pull request here. Remove this section if there is no additional context.


Patch:
diff --git a/docs/reference/openapi-rules.md b/docs/reference/openapi-rules.md
index 684e91d2..bfba0c70 100644
--- a/docs/reference/openapi-rules.md
+++ b/docs/reference/openapi-rules.md
@@ -81,10 +81,10 @@ Operation parameters are unique and non-repeating.
 
 Path parameters are correct and valid.
 
-1. for every param referenced in the path string (i.e: `/users/{userId}`), the parameter must be defined in either
-   `path.parameters`, or `operation.parameters` objects.
+1. For every parameters referenced in the path string (i.e: `/users/{userId}`), the parameter must be defined in either
+   `path.parameters`, or `operation.parameters` objects (Non standard HTTP operations will be silently ignored.)
 
-2. every `path.parameters` and `operation.parameters` parameter must be used in the path string
+2. every `path.parameters` and `operation.parameters` parameter must be used in the path string.
 
 **Recommended:** Yes
 
diff --git a/src/rulesets/oas/functions/oasPathParam.ts b/src/rulesets/oas/functions/oasPathParam.ts
index 96b5664d..74a065bb 100644
--- a/src/rulesets/oas/functions/oasPathParam.ts
+++ b/src/rulesets/oas/functions/oasPathParam.ts
@@ -103,6 +103,7 @@ export const oasPathParam: IFunction = (targetVal, _options, paths, vals) => {
 
   // keep track of normalized paths for verifying paths are unique
   const uniquePaths: object = {};
+  const validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];
 
   for (const path in object.paths) {
     if (!object.paths[path]) continue;
@@ -157,10 +158,11 @@ export const oasPathParam: IFunction = (targetVal, _options, paths, vals) => {
       }
     }
 
+    // find parameters set within the operation's 'parameters' object
     for (const op in object.paths[path]) {
       if (!object.paths[path][op]) continue;
 
-      if (op === 'parameters') {
+      if (op === 'parameters' || !validOperationKeys.includes(op)) {
         continue;
       }
 


Test patch:
diff --git a/src/rulesets/oas/functions/__tests__/oasPathParam.test.ts b/src/rulesets/oas/functions/__tests__/oasPathParam.test.ts
index 53261b10..226d4524 100644
--- a/src/rulesets/oas/functions/__tests__/oasPathParam.test.ts
+++ b/src/rulesets/oas/functions/__tests__/oasPathParam.test.ts
@@ -121,6 +121,18 @@ describe('oasPathParam', () => {
     expect(results).toHaveLength(0);
   });
 
+  test('No errors if operation is a not a standard HTTP operation.', async () => {
+    const results = await s.run({
+      paths: {
+        '/foo/{bar}': {
+          'x-not-a-standard-operation': {},
+        },
+      },
+    });
+
+    expect(results).toHaveLength(0);
+  });
+
   test('Error if path parameter definition is set (at the operation level) for a method, but forgotten for another one', async () => {
     const results = await s.run({
       paths: {