Improve documentation of groups endpoint
This commit is contained in:
parent
94b1066c17
commit
cc3c8fdd63
@ -10,7 +10,7 @@ module Groups
|
|||||||
|
|
||||||
def query
|
def query
|
||||||
<<~SQL.squish
|
<<~SQL.squish
|
||||||
SELECT#{' '}
|
SELECT
|
||||||
groups.id,
|
groups.id,
|
||||||
groups.name,
|
groups.name,
|
||||||
groups.icon,
|
groups.icon,
|
||||||
|
@ -5,15 +5,26 @@ require 'swagger_helper'
|
|||||||
RSpec.describe 'groups', type: :request do
|
RSpec.describe 'groups', type: :request do
|
||||||
path '/groups' do
|
path '/groups' do
|
||||||
get('list groups') do
|
get('list groups') do
|
||||||
|
produces 'application/json'
|
||||||
response(200, 'successful') do
|
response(200, 'successful') do
|
||||||
|
schema type: :array,
|
||||||
after do |example|
|
items: {
|
||||||
example.metadata[:response][:content] = {
|
type: :object,
|
||||||
'application/json' => {
|
required: %i[id name icon parent_id color total considered invited confirmed declined tentative],
|
||||||
example: JSON.parse(response.body, symbolize_names: true)
|
properties: {
|
||||||
|
id: { type: :string, format: :uuid, required: true },
|
||||||
|
name: { type: :string },
|
||||||
|
icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' },
|
||||||
|
parent_id: { type: :string, format: :uuid },
|
||||||
|
color: { type: :string, pattern: '^#(?:[0-9a-fA-F]{3}){1,2}$' },
|
||||||
|
total: { type: :integer, minimum: 0, description: 'Total number of guests in any status' },
|
||||||
|
considered: { type: :integer, minimum: 0 },
|
||||||
|
invited: { type: :integer, minimum: 0 },
|
||||||
|
confirmed: { type: :integer, minimum: 0 },
|
||||||
|
declined: { type: :integer, minimum: 0 },
|
||||||
|
tentative: { type: :integer, minimum: 0 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
|
||||||
run_test!
|
run_test!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user