mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Fix some openapi spec issues (#14037)
- Remove duplicate paths - Remove query param listed in the path
This commit is contained in:
parent
c75500b871
commit
b35695e411
@ -125,13 +125,11 @@ describe 'groups' do
|
|||||||
run_test!
|
run_test!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
path '/groups/{name}.json' do
|
|
||||||
get 'Get a group' do
|
get 'Get a group' do
|
||||||
tags 'Groups'
|
tags 'Groups'
|
||||||
consumes 'application/json'
|
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
|
expected_request_schema = nil
|
||||||
|
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
@ -139,29 +137,7 @@ describe 'groups' do
|
|||||||
expected_response_schema = load_spec_schema('group_response')
|
expected_response_schema = load_spec_schema('group_response')
|
||||||
schema expected_response_schema
|
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 }
|
|
||||||
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 }
|
|
||||||
|
|
||||||
it_behaves_like "a JSON endpoint", 200 do
|
it_behaves_like "a JSON endpoint", 200 do
|
||||||
let(:expected_response_schema) { expected_response_schema }
|
let(:expected_response_schema) { expected_response_schema }
|
||||||
@ -172,6 +148,26 @@ describe 'groups' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
path '/groups/{id}/members.json' do
|
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
|
put 'Add group members' do
|
||||||
tags 'Groups'
|
tags 'Groups'
|
||||||
consumes 'application/json'
|
consumes 'application/json'
|
||||||
|
@ -746,15 +746,15 @@ describe 'topics' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
path '/top.json?period={flag}' do
|
path '/top.json' do
|
||||||
get 'Get the top topics filtered by a flag' do
|
get 'Get the top topics filtered by period' do
|
||||||
tags 'Topics'
|
tags 'Topics'
|
||||||
consumes 'application/json'
|
consumes 'application/json'
|
||||||
parameter name: 'Api-Key', in: :header, type: :string, required: true
|
parameter name: 'Api-Key', in: :header, type: :string, required: true
|
||||||
parameter name: 'Api-Username', in: :header, type: :string, required: true
|
parameter name: 'Api-Username', in: :header, type: :string, required: true
|
||||||
parameter(
|
parameter(
|
||||||
name: :flag,
|
name: :period,
|
||||||
in: :path,
|
in: :query,
|
||||||
type: :string,
|
type: :string,
|
||||||
description: 'Enum: `all`, `yearly`, `quarterly`, `monthly`, `weekly`, `daily`')
|
description: 'Enum: `all`, `yearly`, `quarterly`, `monthly`, `weekly`, `daily`')
|
||||||
|
|
||||||
@ -843,7 +843,7 @@ describe 'topics' do
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
let(:flag) { 'all' }
|
let(:period) { 'all' }
|
||||||
|
|
||||||
run_test!
|
run_test!
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user