grape-swagger-rails icon indicating copy to clipboard operation
grape-swagger-rails copied to clipboard

Authorization header issue before initialize `SwaggerUI`

Open mur-wtag opened this issue 8 years ago • 4 comments

CORE-826

Bug Description:

Consider this code block:

This code block going to initialize SwaggerUi. But To initialize SwaggerUi we need to have authorization header. And the inside onComplete we are adding Authorization Header by calling addApiKeyAuthorization().

So, initialization of SwaggerUi fails and triggers onFaiulre :p And this resolution is to add header before initialize SwaggerUI

Some discussions:

  • https://groups.google.com/forum/#!topic/swagger-swaggersocket/tJ0YHdTnBRk
  • https://github.com/swagger-api/swagger-ui/issues/1171#issuecomment-100374999

mur-wtag avatar Sep 28 '16 07:09 mur-wtag

1 Warning
:warning: Unless you’re refactoring existing code, please update CHANGELOG.md.
1 Message
:book: We really appreciate pull requests that demonstrate issues, even without a fix. That said, the next step is to try and fix the failing tests!

Here's an example of a CHANGELOG.md entry:

* [#73](https://github.com/ruby-grape/grape-swagger-rails/pull/73): Authorization header issue before initialize `SwaggerUI` - [@mur-wtag](https://github.com/mur-wtag).

Generated by :no_entry_sign: danger

grape-bot avatar Sep 28 '16 07:09 grape-bot

Do you think you can write a test that actually reproduces this?

dblock avatar Sep 28 '16 15:09 dblock

@mur-wtag I think the idea was to create a capybara/selenium spec that with will fail unless your fix is available. See https://github.com/ruby-grape/grape-swagger-rails/blob/master/spec/features/swagger_spec.rb to find spec samples

serggl avatar Oct 03 '16 13:10 serggl

+1 @serggl, right now these specs pass, so make a spec that fails, apply a fix and see it succeed

dblock avatar Oct 03 '16 18:10 dblock