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 parameters with no name cause an exception in console #2161

Closed
hkosova opened this issue May 27, 2020 · 0 comments · Fixed by #2162
Closed

Path parameters with no name cause an exception in console #2161

hkosova opened this issue May 27, 2020 · 0 comments · Fixed by #2162

Comments

@hkosova
Copy link
Contributor

hkosova commented May 27, 2020

Q&A (please complete the following information)

  • OS: Windows 10
  • Browser: Chrome latest
  • Method of installation: https://editor.swagger.io
  • Swagger-Editor version: 3.9.0
  • Swagger/OpenAPI version: 2.0, 3.0

Content & configuration

swagger: '2.0'
info:
  title: Parameter name case test
  version: 0.0.0
paths:
  /foo/{id}:
    get:
      parameters:
        - in: path
          type: integer
          required: true
      responses:
        200:
          description: OK

Describe the bug you're encountering

During semantic validation, this line
https://github.com/ralphdoe/swagger-editor/blob/master/src/plugins/validate-semantic/validators/helpers.js#L42
tries to convert the parameter name to lower case. But if the parameter has no name, then toLowerCase() will raise an exception.

PR: #2162

To reproduce...

  1. Go to https://editor.swagger.io.
  2. Open the browser console.
  3. Replace the default definition with the one provided above.
  4. Wait 1 minute.

Expected behavior

No exceptions in console.

Actual behavior

Uncaught (in promise) TypeError: Cannot read property 'toLowerCase' of undefined
    at helpers.js:42
    at Array.find (<anonymous>)
    at helpers.js:42
    at Array.forEach (<anonymous>)
    at tn (helpers.js:37)
    at paths.js:37
    at u (runtime.js:45)
    at Generator._invoke (runtime.js:271)
    at Generator.forEach.e.<computed> [as next] (runtime.js:97)
    at i (asyncToGenerator.js:5)

Screenshots

image

Additional context or thoughts

n/a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant