ruby-grape/grape-swagger

Incomplete entity name for swagger documentation

mrexox opened this issue · 2 comments

I've met a problem with swagger documentation because of this method, that parses model name and leaves the last exact entity name (if it is nested). It might be a problem for the case I am going to describe.

def model_name(name)
GrapeSwagger::DocMethods::DataType.parse_entity_name(name)
end

For my project I use this versioning approach:

module API
  module SomeModel
    class V1 < Grape::Entity
      ...
    end
    
    class V2 < Grape::Entity
      ...
    end
  end
end

So, for that case parsing of a model to model name returns just "V1" or "V2". That is why all endpoints that end with V1 will represent the last parsed endpoint.

Could the parsed model name be widened to all the described entity name?

this is always an ongoing discussion 😉 …

but your arguments are the most reasonable for the moment to change to full name

a PR is welcome 😄

@LeFnord , that's it! #786