In the project I'm using
gem 'grape'
gem 'grape-swagger'
I have a namespace in the API that is responsible for the users END-points
namespace :users do
mount V1::Users::AuthAPI
mount V1::Users::MaterialsAPI
...
end
Each of the mounted files has its own namespace, for example app/api/v1/users/materials_api.rb
namespace :materials do
...
end
In the swagger documentation, this is displayed in such a way that all paths belong to the users namespace
How can I break these paths into sections?
CodePudding user response:
Though I haven't used grape-swagger, you can achieve that by using tags
and assigning to each endpoint a tag
.
openapi: 3.0.0
....
tags:
- name: users
description: something about users
- name: materials
description: something about materials
paths:
/api/v1/users/auth:
post:
tags:
- users
...
/api/v1/users/materials:
get:
tags:
- materials
....
That config should render something like this:
I see grape-swagger has this https://github.com/ruby-grape/grape-swagger#tags-