Skip to content

Failing to use description for summary when neither detail nor summary are provided #734

Open
@radanskoric

Description

@radanskoric

Right now, if an endpoint doesn't declare anything beyond the default desc value, the summary field will be empty.

I.e. if this is done:

desc 'A short endpoint description'
get '/endpoint' do
end

The swagger documentation for this endpoint will not contain the summary field. This is a problem because if you then render using something like Swagger UI the resulting rendering will not contain any short description, the line will have just the url, like this:

screen shot 2018-12-13 at 09 50 34

This seems to me like undesirable behaviour since the endpoint would look more informative if it used the desc value as summary.

This behaviour is right now encoded in specs, although indirectly. There are many specs but one of the simpler cases is in the mounted_target_class_spec which declares an endpoint with just desc but then doesn't expect any summary in the result.

I have a hunch that it didn't used to be like this since the code tries to read the desc attribute of route options and use it as summary but current version of grape never sets that attribute anywhere in the code.

Is this really desirable behaviour or a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions