After updating grape to 1.2.5 target_class options seems not working

Abierto
#767 2 comentarios 2 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
ruby

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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)
Lenguaje dominante
Ruby
Estrellas
1.1k
Forks
477
Merge medio
1 d 18 h
PR fusionados (30 d)
5

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ruby-grape/grape-swagger

Todos los issues de ruby-grape/grape-swagger

Issues similares

Más issues de Ruby

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.