rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.71k stars 285 forks source link

AUTHENTICATION section's SET button does nothing for Bearer #27

Closed elonmallin closed 5 years ago

elonmallin commented 5 years ago

The "SET" button in the "AUTHENTICATION" section does nothing when the security scheme is bearer:

...
"security": [
    {
      "Bearer": []
    }
  ]
...
"components": {
  "securitySchemes": {
        "Bearer": {
          "type": "http",
          "scheme": "bearer",
          "bearerFormat": "JWT",
          "description": "Some description"
        }
      }
}

If I use "type": "apiKey" and set the name and in fields the "SET" button will work though.

elonmallin commented 5 years ago

Found the problem at: https://github.com/mrin9/RapiDoc/blob/master/src/components/security-schemes.js#L149 Seems like inputname is never set for http/bearer but it is for apiKey. Not sure exactly where to solve it though.

Could simply apend || apiEl.querySelector('input') to make sure it gets the input if we don't find it by inputname.

mrin9 commented 5 years ago

thanks for pointing it out, will rework on this piece to fix this and another issue

mrin9 commented 5 years ago

This should be fixed in 5.0.3