TheTrueMzungu
TheTrueMzungu

Reputation: 45

Grape-Swagger: Route Parameter issues

I am using grape-swagger to show documentation on my Ruby API I'm building using Grape.

I am adding descriptions to all of my parameters on my endpoints but I can't seem to find anything about how to add descriptions to route parameters.

I have tried the following:

route_param :monitor_name, type: String, desc: 'The name of the monitor that is being retrieved.' do

and

route_param :monitor_name, type: String, description: 'The name of the monitor that is being retrieved.' do

but neither of those will display the actual description on the swagger UI.

Any ideas?

p.s. (the only thing I found in the grape documentation is shown in the attach image)

enter image description here

Upvotes: 2

Views: 258

Answers (2)

Resheta Ahmed Smrity
Resheta Ahmed Smrity

Reputation: 16

You can try to add the desc outside route_params block, like this:

namespace 'order' do
  desc 'This will be your summary', tags: ['orders']
  get :order_id do
    ...
  end
end

Source: Github documentation of grape-swagger

Upvotes: 0

AlexJSK
AlexJSK

Reputation: 25

You could use

route_param :monitor_name, type: String, documentation: { desc:'The name of the monitor that is being retrieved.' }

Upvotes: 0

Related Questions