A platform for community discussion. Free, open, simple.
FIX: update id types in API docs to integers (#27412)
Dylan Yange92a82aa1d16
diff --git a/spec/requests/api/posts_spec.rb b/spec/requests/api/posts_spec.rbindex e2041e8c3bd..51e4a672a69 100644--- a/spec/requests/api/posts_spec.rb+++ b/spec/requests/api/posts_spec.rb@@ -117,7 +117,7 @@ RSpec.describe "posts" dotype: %i[string null],},flair_group_id: {- type: %i[string null],+ type: %i[integer null],},version: {type: :integer,@@ -191,7 +191,7 @@ RSpec.describe "posts" dotype: :boolean,},reviewable_id: {- type: %i[string null],+ type: %i[integer null],},reviewable_score_count: {type: :integer,@@ -261,6 +261,29 @@ RSpec.describe "posts" dolet(:expected_request_schema) { expected_request_schema }endend++ response "200", "single reviewable post" do+ expected_response_schema = load_spec_schema("post_show_response")+ schema expected_response_schema++ let(:id) do+ topic = Fabricate(:topic)+ post = Fabricate(:post, topic: topic)+ Fabricate(:reviewable_flagged_post, topic: topic, target: post)++ post.id+ end++ let(:moderator) { Fabricate(:moderator) }+ before { sign_in(moderator) }++ run_test!++ it_behaves_like "a JSON endpoint", 200 do+ let(:expected_response_schema) { expected_response_schema }+ let(:expected_request_schema) { expected_request_schema }+ end+ endendput "Update a single post" do@@ -570,7 +593,7 @@ RSpec.describe "posts" dotype: :object,},reviewable_id: {- type: %i[string null],+ type: %i[integer null],},reviewable_score_count: {type: :integer,diff --git a/spec/requests/api/private_messages_spec.rb b/spec/requests/api/private_messages_spec.rbindex 2086302e785..5e13feefcfb 100644--- a/spec/requests/api/private_messages_spec.rb+++ b/spec/requests/api/private_messages_spec.rb@@ -178,7 +178,7 @@ RSpec.describe "private messages" dotype: :integer,},primary_group_id: {- type: %i[string null],+ type: %i[integer null],},},},@@ -198,7 +198,7 @@ RSpec.describe "private messages" dotype: :integer,},primary_group_id: {- type: %i[string null],+ type: %i[integer null],},},},@@ -385,7 +385,7 @@ RSpec.describe "private messages" dotype: :integer,},primary_group_id: {- type: %i[string null],+ type: %i[integer null],},},},diff --git a/spec/requests/api/schemas/json/admin_user_response.json b/spec/requests/api/schemas/json/admin_user_response.jsonindex e268a83077a..6b6d902c1fa 100644--- a/spec/requests/api/schemas/json/admin_user_response.json+++ b/spec/requests/api/schemas/json/admin_user_response.json@@ -144,7 +144,7 @@]},"primary_group_id": {- "type": ["string", "null"]+ "type": ["integer", "null"]},"badge_count": {"type": "integer"@@ -411,7 +411,7 @@"type": ["string", "null"]},"flair_group_id": {- "type": ["string", "null"]+ "type": ["integer", "null"]},"bio_raw": {"type": ["string", "null"]diff --git a/spec/requests/api/schemas/json/category_topics_response.json b/spec/requests/api/schemas/json/category_topics_response.jsonindex aba3b4deb7a..8f15282e8ad 100644--- a/spec/requests/api/schemas/json/category_topics_response.json+++ b/spec/requests/api/schemas/json/category_topics_response.json@@ -176,7 +176,7 @@},"primary_group_id": {"type": [- "string",+ "integer","null"]}diff --git a/spec/requests/api/schemas/json/post_replies_response.json b/spec/requests/api/schemas/json/post_replies_response.jsonindex aa3f0c0b337..8c9ecb3e582 100644--- a/spec/requests/api/schemas/json/post_replies_response.json+++ b/spec/requests/api/schemas/json/post_replies_response.json@@ -103,7 +103,7 @@},"flair_group_id": {"type": [- "string",+ "integer","null"]},@@ -155,7 +155,7 @@},"actions_summary": {"type": "array",- "items":+ "items":{"type": "object","additionalProperties": false,@@ -214,7 +214,7 @@},"reviewable_id": {"type": [- "string",+ "integer","null"]},diff --git a/spec/requests/api/schemas/json/post_show_response.json b/spec/requests/api/schemas/json/post_show_response.jsonindex 1e16c83d676..2148cd0a0f9 100644--- a/spec/requests/api/schemas/json/post_show_response.json+++ b/spec/requests/api/schemas/json/post_show_response.json@@ -90,7 +90,7 @@},"flair_group_id": {"type": [- "string",+ "integer","null"]},@@ -193,7 +193,7 @@},"reviewable_id": {"type": [- "string",+ "integer","null"]},diff --git a/spec/requests/api/schemas/json/post_update_response.json b/spec/requests/api/schemas/json/post_update_response.jsonindex e395b053e04..da253ae720d 100644--- a/spec/requests/api/schemas/json/post_update_response.json+++ b/spec/requests/api/schemas/json/post_update_response.json@@ -94,7 +94,7 @@},"flair_group_id": {"type": [- "string",+ "integer","null"]},@@ -191,7 +191,7 @@},"reviewable_id": {"type": [- "string",+ "integer","null"]},diff --git a/spec/requests/api/schemas/json/topic_create_response.json b/spec/requests/api/schemas/json/topic_create_response.jsonindex d142fd2d782..6cfbaac4f37 100644--- a/spec/requests/api/schemas/json/topic_create_response.json+++ b/spec/requests/api/schemas/json/topic_create_response.json@@ -105,7 +105,7 @@},"flair_group_id": {"type": [- "string",+ "integer","null"]},@@ -200,7 +200,7 @@},"reviewable_id": {"type": [- "string",+ "integer","null"]},diff --git a/spec/requests/api/schemas/json/topic_show_response.json b/spec/requests/api/schemas/json/topic_show_response.jsonindex b6fe0b92023..7c728075233 100644--- a/spec/requests/api/schemas/json/topic_show_response.json+++ b/spec/requests/api/schemas/json/topic_show_response.json@@ -836,7 +836,7 @@},"flair_group_id": {"type": [- "string",+ "integer","null"]},diff --git a/spec/requests/api/schemas/json/user_get_response.json b/spec/requests/api/schemas/json/user_get_response.jsonindex 70fc13f671b..1bf590efc3c 100644--- a/spec/requests/api/schemas/json/user_get_response.json+++ b/spec/requests/api/schemas/json/user_get_response.json@@ -119,7 +119,7 @@},"primary_group_id": {"type": [- "string",+ "integer","null"]},@@ -131,7 +131,7 @@},"flair_group_id": {"type": [- "string",+ "integer","null"]},@@ -182,7 +182,7 @@},"uploaded_avatar_id": {"type": [- "string",+ "integer","null"]},diff --git a/spec/requests/api/tags_spec.rb b/spec/requests/api/tags_spec.rbindex 2c282aab592..218adcdcc21 100644--- a/spec/requests/api/tags_spec.rb+++ b/spec/requests/api/tags_spec.rb@@ -444,7 +444,7 @@ RSpec.describe "tags" dotype: :integer,},primary_group_id: {- type: %i[string null],+ type: %i[integer null],},},},diff --git a/spec/requests/api/topics_spec.rb b/spec/requests/api/topics_spec.rbindex 1de78096b6a..adc166264b0 100644--- a/spec/requests/api/topics_spec.rb+++ b/spec/requests/api/topics_spec.rb@@ -627,7 +627,7 @@ RSpec.describe "topics" dotype: :integer,},primary_group_id: {- type: %i[string null],+ type: %i[integer null],},},},@@ -827,7 +827,7 @@ RSpec.describe "topics" dotype: :integer,},primary_group_id: {- type: %i[string null],+ type: %i[integer null],},},},@@ -966,7 +966,7 @@ RSpec.describe "topics" dotype: :boolean,},category_id: {- type: %i[string null],+ type: %i[integer null],},}diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rbindex dd1b6222823..0b6da1aee1f 100644--- a/spec/requests/api/users_spec.rb+++ b/spec/requests/api/users_spec.rb@@ -68,6 +68,18 @@ RSpec.describe "users" dolet(:expected_request_schema) { expected_request_schema }endend++ response "200", "user with primary group response" do+ expected_response_schema = load_spec_schema("user_get_response")+ schema expected_response_schema++ let(:username) { Fabricate(:user, primary_group_id: Fabricate(:group).id).username }++ it_behaves_like "a JSON endpoint", 200 do+ let(:expected_response_schema) { expected_response_schema }+ let(:expected_request_schema) { expected_request_schema }+ end+ endendput "Update a user" do