After updating grape to 1.2.5 target_class options seems not working

オープン
#767 コメント 2 件 リアクション 2 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
ruby
領域
api, documentation

調査の方向性

Reproduce the minimal Rails example and follow the stack trace into grape-swagger.rb, especially combine_routes around lines 27 and 41 and add_swagger_documentation around line 129. Check how target_class is passed after the grape 1.2.5 update; done means the example mounts without the nil.unshift error and the Swagger routes remain available.

索引モデルが issue の本文から書いたものです。

説明

Hello!
After we updated grape to 1.2.5 we can no longer mount grape (inside rails application),
here is minimal failing example:

# frozen_string_literal: true

module API
  module V2
    class Root < Grape::API
      get :path do
      end
    end

    class Documentation < Grape::API
      add_swagger_documentation(
        target_class: ::API::V2::Root,
      )
    end
  end
end

and here is stack trace:

8: from /.../.rvm/gems/ruby-2.6.5/gems/grape-1.2.5/lib/grape/api.rb:40:in `block (2 levels) in override_all_methods!'
7: from /.../.rvm/gems/ruby-2.6.5/gems/grape-1.2.5/lib/grape/api.rb:144:in `add_setup'
6: from /.../.rvm/gems/ruby-2.6.5/gems/grape-1.2.5/lib/grape/api.rb:144:in `each'
5: from /.../.rvm/gems/ruby-2.6.5/gems/grape-1.2.5/lib/grape/api.rb:145:in `block in add_setup'
4: from /.../.rvm/gems/ruby-2.6.5/gems/grape-1.2.5/lib/grape/api.rb:153:in `replay_step_on'
3: from /.../.rvm/gems/ruby-2.6.5/gems/grape-swagger-0.33.0/lib/grape-swagger.rb:129:in `add_swagger_documentation'
2: from /.../.rvm/gems/ruby-2.6.5/gems/grape-swagger-0.33.0/lib/grape-swagger.rb:27:in `combine_routes'
1: from /.../.rvm/gems/ruby-2.6.5/gems/grape-swagger-0.33.0/lib/grape-swagger.rb:27:in `each'
/.../.rvm/gems/ruby-2.6.5/gems/grape-swagger-0.33.0/lib/grape-swagger.rb:41:in `block in combine_routes': undefined method `unshift' for nil:NilClass (NoMethodError)
主要言語
Ruby
スター
1.1k
フォーク
477
平均マージ
1日 18時間
マージ済み PR(30日)
5

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ruby-grape/grape-swagger のほかの issue

ruby-grape/grape-swagger の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。