grape-swagger-entity icon indicating copy to clipboard operation
grape-swagger-entity copied to clipboard

How do I set the description of a grape entity model?

Open sharkey11 opened this issue 3 years ago • 2 comments

Right now, the description of the model is automatically written as "{MODEL_NAME} Model" and put in the swagger docs. How do we override that?

sharkey11 avatar Nov 02 '22 18:11 sharkey11

I would like to know this as well if anyone figures out how. I did figure out how to set the model name:

class MyNamedEntity < Grape::Entity
  def self.entity_name; 'MyNewName'; end
end

A full example can be found here: https://github.com/ruby-grape/grape-entity/issues/121

This is nice b/c it lets you not have a lot of the namespace stuff in the name of your generated model types. Of course, this feels like a total hack to me rn. If anyone has a better way I'd be interested to know it too.

DataDaoDe avatar Jan 15 '23 21:01 DataDaoDe

The entity_name method is nice indeed but I think the question was more about a desc value in the model definition. I don't think that's currently doable.

pirhoo avatar May 17 '24 10:05 pirhoo