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

we can update the host in the path in the request builder #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KJAVA19811815
Copy link

No description provided.

@drewish
Copy link
Owner

drewish commented May 29, 2019

I'm not quite sure I understand what the purpose of this change would be. Could you provide an example of how you'd be using it?

@KJAVA19811815
Copy link
Author

Our API is on a different host, so we were not able to set the API in the basePath. This was making our generated swagger UI invalid. We were trying to set the host in the helper, this led to failing swagger spec's. RSPEC was not able to figure out the host. So we needed a way to update the host.

require 'rspec/rails/swagger'
require 'rails_helper'

RSpec.configure do |config|
  # Specify a root directory where the generated Swagger files will be saved.
  config.swagger_root = Rails.root.to_s + '/swagger'


  # Define one or more Swagger documents and global metadata for each.
  config.swagger_docs = {
    'v1/swagger.json' => {
      swagger: '2.0',
      info: {
        title: 'API V1',
        version: 'v1'
      },
      host: 'xyz.com',
      basePath: '/',
      schemes: ['https'],
    }
  }
end

@drewish
Copy link
Owner

drewish commented Aug 28, 2019

So you're trying to run the specs against a live web server? Was that working well for you?

@diogob
Copy link

diogob commented Oct 18, 2019

Hi @drewish I work with @KJAVA19811815, thanks for creating and sharing the project, it has been really useful for us.

We generate the swagger docs and point a web server location to that static directory.
The specs run during the integration, but the swagger ui we have in the same server uses the host info from the json to generate the live example API calls.

You can see the results here https://developer.coinberry.com (the prices endpoint does not require authentication BTW).

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

Successfully merging this pull request may close these issues.

3 participants