DEV: Fix some openapi spec issues (#14037)

DEV: Fix some openapi spec issues (#14037)

  • Remove duplicate paths
  • Remove query param listed in the path
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb
index 378ddc4..3973ec9 100644
--- a/spec/requests/api/groups_spec.rb
+++ b/spec/requests/api/groups_spec.rb
@@ -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,7 +137,7 @@ describe 'groups' do
         expected_response_schema = load_spec_schema('group_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 }
@@ -149,11 +147,11 @@ describe 'groups' do
     end
   end
 
-  path '/groups/{name}/members.json' do
+  path '/groups/{id}/members.json' do
     get 'List group members' 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'
@@ -161,7 +159,7 @@ describe 'groups' 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 }
@@ -169,9 +167,7 @@ describe 'groups' do
         end
       end
     end
-  end
 
-  path '/groups/{id}/members.json' do
     put 'Add group members' do
       tags 'Groups'
       consumes 'application/json'
diff --git a/spec/requests/api/topics_spec.rb b/spec/requests/api/topics_spec.rb
index 0121fdf..a2c2eec 100644
--- a/spec/requests/api/topics_spec.rb
+++ b/spec/requests/api/topics_spec.rb
@@ -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

GitHub sha: b35695e411649478048d50c7099550759969cf25

This commit appears in #14037 which was approved by CvX. It was merged by blake.