DEV: Fix some openapi spec issues (#14037)

- Remove duplicate paths
- Remove query param listed in the path
This commit is contained in:
Blake Erickson 2021-08-13 04:22:15 -06:00 committed by GitHub
parent c75500b871
commit b35695e411
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 31 deletions

View File

@ -125,13 +125,11 @@ describe 'groups' do
run_test!
end
end
end
path '/groups/{name}.json' do
get 'Get a group' do
tags 'Groups'
consumes 'application/json'
parameter name: :name, in: :path, type: :string
parameter name: :id, in: :path, type: :string, example: 'name', description: "Use group name instead of id"
expected_request_schema = nil
produces 'application/json'
@ -139,29 +137,7 @@ describe 'groups' do
expected_response_schema = load_spec_schema('group_response')
schema expected_response_schema
let(:name) { Fabricate(:group).name }
it_behaves_like "a JSON endpoint", 200 do
let(:expected_response_schema) { expected_response_schema }
let(:expected_request_schema) { expected_request_schema }
end
end
end
end
path '/groups/{name}/members.json' do
get 'List group members' do
tags 'Groups'
consumes 'application/json'
parameter name: :name, in: :path, type: :string
expected_request_schema = nil
produces 'application/json'
response '200', 'success response' do
expected_response_schema = load_spec_schema('group_members_response')
schema expected_response_schema
let(:name) { Fabricate(:group).name }
let(:id) { Fabricate(:group).name }
it_behaves_like "a JSON endpoint", 200 do
let(:expected_response_schema) { expected_response_schema }
@ -172,6 +148,26 @@ describe 'groups' do
end
path '/groups/{id}/members.json' do
get 'List group members' do
tags 'Groups'
consumes 'application/json'
parameter name: :id, in: :path, type: :string, example: 'name', description: "Use group name instead of id"
expected_request_schema = nil
produces 'application/json'
response '200', 'success response' do
expected_response_schema = load_spec_schema('group_members_response')
schema expected_response_schema
let(:id) { Fabricate(:group).name }
it_behaves_like "a JSON endpoint", 200 do
let(:expected_response_schema) { expected_response_schema }
let(:expected_request_schema) { expected_request_schema }
end
end
end
put 'Add group members' do
tags 'Groups'
consumes 'application/json'

View File

@ -746,15 +746,15 @@ describe 'topics' do
end
end
path '/top.json?period={flag}' do
get 'Get the top topics filtered by a flag' do
path '/top.json' do
get 'Get the top topics filtered by period' do
tags 'Topics'
consumes 'application/json'
parameter name: 'Api-Key', in: :header, type: :string, required: true
parameter name: 'Api-Username', in: :header, type: :string, required: true
parameter(
name: :flag,
in: :path,
name: :period,
in: :query,
type: :string,
description: 'Enum: `all`, `yearly`, `quarterly`, `monthly`, `weekly`, `daily`')
@ -843,7 +843,7 @@ describe 'topics' do
},
}
let(:flag) { 'all' }
let(:period) { 'all' }
run_test!
end