From 5dfc0eb7fcdd06dd93bbcf6137085a638659d142 Mon Sep 17 00:00:00 2001 From: James Dean Shepherd Date: Mon, 27 Oct 2025 16:27:17 +0000 Subject: [PATCH 1/4] Fix deprecation warning - Rails 8.1 routing methods expect keyword args --- lib/apipie/routing.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/apipie/routing.rb b/lib/apipie/routing.rb index a2ce2ad17..9a5b208fb 100644 --- a/lib/apipie/routing.rb +++ b/lib/apipie/routing.rb @@ -5,7 +5,7 @@ def apipie(options = {}) namespace "apipie", :path => Apipie.configuration.doc_base_url do get 'apipie_checksum', :to => "apipies#apipie_checksum", :format => "json" constraints(:version => %r{[^/]+}, :resource => %r{[^/]+}, :method => %r{[^/]+}) do - get(options.reverse_merge("(:version)/(:resource)/(:method)" => "apipies#index", :as => :apipie)) + get(**options.reverse_merge("(:version)/(:resource)/(:method)" => "apipies#index", :as => :apipie)) end end end From e0985f2b0294f76e36e9d3ac42c9769dea343d13 Mon Sep 17 00:00:00 2001 From: James Dean Shepherd Date: Mon, 27 Oct 2025 16:39:27 +0000 Subject: [PATCH 2/4] Skip use of keyword args in router for Rails < 5.2 --- lib/apipie/routing.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/apipie/routing.rb b/lib/apipie/routing.rb index 9a5b208fb..78cd0d0a5 100644 --- a/lib/apipie/routing.rb +++ b/lib/apipie/routing.rb @@ -5,7 +5,11 @@ def apipie(options = {}) namespace "apipie", :path => Apipie.configuration.doc_base_url do get 'apipie_checksum', :to => "apipies#apipie_checksum", :format => "json" constraints(:version => %r{[^/]+}, :resource => %r{[^/]+}, :method => %r{[^/]+}) do - get(**options.reverse_merge("(:version)/(:resource)/(:method)" => "apipies#index", :as => :apipie)) + if Rails.version >= "5.2" + get(**options.reverse_merge("(:version)/(:resource)/(:method)" => "apipies#index", :as => :apipie)) + else + get(options.reverse_merge("(:version)/(:resource)/(:method)" => "apipies#index", :as => :apipie)) + end end end end From 2958491832835337f75ece7c4e72780f346cd7e6 Mon Sep 17 00:00:00 2001 From: James Dean Shepherd Date: Mon, 27 Oct 2025 17:41:49 +0000 Subject: [PATCH 3/4] Add Rails 8.1 to CI build matrix --- .github/workflows/build.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b3e31f7ab..749acc91c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - rails: ["8.0", "7.2", "7.1", "7.0", "6.1", "6.0"] + rails: ["8.1", "8.0", "7.2", "7.1", "7.0", "6.1", "6.0"] ruby: ["3.4", "3.3", "3.2", "3.1", "3.0", "2.7"] include: - rails: "5.2" @@ -34,6 +34,12 @@ jobs: ruby: "3.0" - rails: "8.0" ruby: "3.1" + - rails: "8.1" + ruby: "2.7" + - rails: "8.1" + ruby: "3.0" + - rails: "8.1" + ruby: "3.1" env: RAILS_VERSION: ${{ matrix.rails }} From 9283da9b8b9bf28f24973ab47a8acf5edbe355db Mon Sep 17 00:00:00 2001 From: James Dean Shepherd Date: Mon, 27 Oct 2025 17:53:43 +0000 Subject: [PATCH 4/4] Refactor and tidy Rails 8.1 router keyword args deprecation fix --- lib/apipie/routing.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/apipie/routing.rb b/lib/apipie/routing.rb index 78cd0d0a5..e7d1fc7d1 100644 --- a/lib/apipie/routing.rb +++ b/lib/apipie/routing.rb @@ -5,11 +5,9 @@ def apipie(options = {}) namespace "apipie", :path => Apipie.configuration.doc_base_url do get 'apipie_checksum', :to => "apipies#apipie_checksum", :format => "json" constraints(:version => %r{[^/]+}, :resource => %r{[^/]+}, :method => %r{[^/]+}) do - if Rails.version >= "5.2" - get(**options.reverse_merge("(:version)/(:resource)/(:method)" => "apipies#index", :as => :apipie)) - else - get(options.reverse_merge("(:version)/(:resource)/(:method)" => "apipies#index", :as => :apipie)) - end + get_args = options.reverse_merge("(:version)/(:resource)/(:method)" => "apipies#index", :as => :apipie) + + Rails.version >= "5.2" ? get(**get_args) : get(get_args) end end end