Yes, it is possible to have multiple docks in a single project using rswag rails. You can define multiple SwaggerUI endpoints using the swagger_api
method in your config/routes.rb
file, and then define separate docks for each endpoint in your config/initializers/rswag-api.rb
file.
For example, if you want to define two separate endpoints for your API, you could add the following code to your config/routes.rb
file:
# Define endpoint for API v1
namespace :api do
namespace :v1 do
swagger_api :v1 do
# SwaggerUI documentation for API v1
end
end
end
# Define endpoint for API v2
namespace :api do
namespace :v2 do
swagger_api :v2 do
# SwaggerUI documentation for API v2
end
end
end
Then, in your config/initializers/rswag-api.rb
file, you can define separate docks for each endpoint:
# Define dock for API v1
Rswag::Api.configure do |config|
config.swagger_root = Rails.root.to_s + '/swagger/v1'
config.swagger_dry_run = false
end
# Define dock for API v2
Rswag::Api.configure do |config|
config.swagger_root = Rails.root.to_s + '/swagger/v2'
config.swagger_dry_run = false
end
This way, you can have separate SwaggerUI documentation for each endpoint, while still using rswag rails to generate and manage the documentation for each endpoint.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-05-26 11:00:00 +0000
Seen: 15 times
Last updated: Feb 16 '23
How can one obtain live data from interactive broker through API?
Why am I not getting a response when making a URL call in ASP.NET Web API?
How can I retrieve folders using the Vimeo API?
How can the integration between Ready API tool and Zephyr squad be accomplished?
Does Amazon SP API have a designated endpoint to obtain a seller's identification?
What is the process to restrict Google API key using HTTP referrers?