Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path Params being applied to more than http operations #1187

Closed
bzmw opened this issue May 28, 2020 · 3 comments · Fixed by #1227
Closed

Path Params being applied to more than http operations #1187

bzmw opened this issue May 28, 2020 · 3 comments · Fixed by #1227
Labels
good first issue Good for newcomers t/bug Something isn't working

Comments

@bzmw
Copy link
Contributor

bzmw commented May 28, 2020

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
@bzmw bzmw added the t/bug Something isn't working label May 28, 2020
@nulltoken
Copy link
Contributor

@bzmw Awesome repro case!

That shouldn't be a complex fix.

A change would be required around that line

for (const path in object.paths) {

And additional tests should be added to oasPathParam.test.ts.

Would you feel like giving it a try?

@bzmw
Copy link
Contributor Author

bzmw commented May 28, 2020

Sorry I don't have time this week to work on a fix. :(

@nulltoken nulltoken added the good first issue Good for newcomers label May 28, 2020
@nulltoken
Copy link
Contributor

Sorry I don't have time this week to work on a fix. :(

No problem 😉

I've tagged this as good first issue. Sadly, my plate is a bit full at the moment, so I probably won't work on it soon.

If you don't beat me to it, I'll try and work on it in the following weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants