Search for routes that contain swagger_doc#877
Search for routes that contain swagger_doc#877igor-drozdov wants to merge 1 commit intoruby-grape:masterfrom
Conversation
If a client-defined route contains `doc` word, then the call to that URL will be unexpectedly performed Let's filter the routes using `swagger_doc` instead
|
@LeFnord could you please have a look at this PR? |
|
@igor-drozdov Thank you for working on this. I am having a problem with this method at the moment as well and it's an edge case you may want to consider in your fix here. The default value for grape-swagger/lib/grape-swagger.rb Line 44 in 9fda24b I override this with a custom path and as a result I can't use the rake task to export documentation because I'm overriding this method for now: require 'rake/tasklib'
module GrapeSwagger
module Rake
class OapiTasks < ::Rake::TaskLib
private
def urls_for(api_class)
api_class.routes
.map(&:path)
.select { |e| e.include?('/open_api') }
.reject { |e| e.include?(':name') }
.map { |e| format_path(e) }
.map { |e| [e, ENV.fetch('resource', nil)].join('/').chomp('/') }
end
end
end
endIf you're able to capture the |
@anothermh thanks for your feedback! Since the variable is configurable, then my fix is a breaking change because someone can have Let's see what @LeFnord thinks about it 👍 |
|
sorry @igor-drozdov …
yes that is exactly the case, mount_path is configurable, so your change can/will break |
If a client-defined route contains
docword, then the call to that URL will be unexpectedly performedLet's filter the routes using
swagger_docinstead