ruby-grape / ruby-grape/grape-swagger

Regression w/ Model parser for Grape::Roar::Representer

Open
#714 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug?
Dominant language
Ruby
Stars
1.1k
Forks
479
Avg merge
2d 14h
Merged PRs (30d)
6

Description

In a much older version of grape-swagger this used to work:

models: [
  Presenters::ApplicationPresenter
]

where

    module Presenters
      module ApplicationPresenter
        include Roar::JSON::HAL
        include Roar::Hypermedia
        include Grape::Roar::Representer

        property :id, type: String, desc: 'Application id.', writeable: false
        ...
      end
    end
  end
end

Even with grape-swagger-representable I am getting:

type: "other_error",
message: "No parser registered for ApplicationPresenter.",
backtrace: [
"/Users/dblock/.rvm/gems/ruby-2.3.7/bundler/gems/grape-swagger-34c969d71899/lib/grape-swagger/endpoint.rb:329:in `expose_params_from_model'",
"/Users/dblock/.rvm/gems/ruby-2.3.7/bundler/gems/grape-swagger-34c969d71899/lib/grape-swagger/endpoint.rb:93:in `block in add_definitions_from'",
"/Users/dblock/.rvm/gems/ruby-2.3.7/bundler/gems/grape-swagger-34c969d71899/lib/grape-swagger/endpoint.rb:93:in `each'",
"/Users/dblock/.rvm/gems/ruby-2.3.7/bundler/gems/grape-swagger-34c969d71899/lib/grape-swagger/endpoint.rb:93:in `add_definitions_from'",
"/Users/dblock/.rvm/gems/ruby-2.3.7/bundler/gems/grape-swagger-34c969d71899/lib/grape-swagger/endpoint.rb:86:in `path_and_definition_objects'",
"/Users/dblock/.rvm/gems/ruby-2.3.7/bundler/gems/grape-swagger-34c969d71899/lib/grape-swagger/doc_methods.rb:57:in `block in setup'",
"/Users/dblock/.rvm/gems/ruby-2.3.7/bundler/gems/grape-swagger-34c969d71899/lib/grape-swagger/doc_methods.rb:71:in `block in setup'",
"/Users/dblock/.rvm/gems/ruby-2.3.7/gems/grape-0.17.0/lib/grape/endpoint.rb:59:in `call'",

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at lib/grape-swagger/endpoint.rb:329, where the reported No parser registered error occurs, and trace how models are passed to the parser registry. Review the grape-swagger-representable integration and compare it with the older working model declaration; done means the ApplicationPresenter model is accepted without this parser error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.