From 9c6544268ced1b3a5caea9c37b44044aa9984f2f Mon Sep 17 00:00:00 2001
From: Igor Drozdov <ihardrozdov@gmail.com>
Date: Tue, 8 Nov 2022 20:34:28 +0100
Subject: [PATCH] Search for routes that contain swagger_doc

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
---
 lib/grape-swagger/rake/oapi_tasks.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/grape-swagger/rake/oapi_tasks.rb b/lib/grape-swagger/rake/oapi_tasks.rb
index caaf63d4..0e15dea5 100644
--- a/lib/grape-swagger/rake/oapi_tasks.rb
+++ b/lib/grape-swagger/rake/oapi_tasks.rb
@@ -95,7 +95,7 @@ def make_request(url)
       def urls_for(api_class)
         api_class.routes
                  .map(&:path)
-                 .select { |e| e.include?('doc') }
+                 .select { |e| e.include?('swagger_doc') }
                  .reject { |e| e.include?(':name') }
                  .map { |e| format_path(e) }
                  .map { |e| [e, ENV.fetch('resource', nil)].join('/').chomp('/') }