DEV: Refactor the api docs for the user endpoint (#14377)

DEV: Refactor the api docs for the user endpoint (#14377)

Due to the way that rswag expands shared components we were getting this warning when linting our api docs:

Component: "user_response" is never used.

This change refactors the api/users_spec.rb file so that it uses the new way of doing things with a separate user_get_response.json schema file rather then the old way of loading a shared response inside of the swagger_helper.rb file.

diff --git a/spec/requests/api/schemas/json/user_create_request.json b/spec/requests/api/schemas/json/user_create_request.json
new file mode 100644
index 0000000..5b8dc36
--- /dev/null
+++ b/spec/requests/api/schemas/json/user_create_request.json
@@ -0,0 +1,32 @@
+{
+  "additionalProperties": false,
+  "properties": {
+    "name": {
+      "type": "string"
+    },
+    "email": {
+      "type": "string"
+    },
+    "password": {
+      "type": "string"
+    },
+    "username": {
+      "type": "string"
+    },
+    "active": {
+      "type": "boolean"
+    },
+    "approved": {
+      "type": "boolean"
+    },
+    "user_fields[1]": {
+      "type": "boolean"
+    }
+  },
+  "required": [
+    "name",
+    "email",
+    "password",
+    "username"
+  ]
+}
diff --git a/spec/requests/api/schemas/json/user_create_response.json b/spec/requests/api/schemas/json/user_create_response.json
new file mode 100644
index 0000000..8a9c277
--- /dev/null
+++ b/spec/requests/api/schemas/json/user_create_response.json
@@ -0,0 +1,22 @@
+{
+  "additionalProperties": false,
+  "properties": {
+    "success": {
+      "type": "boolean"
+    },
+    "active": {
+      "type": "boolean"
+    },
+    "message": {
+      "type": "string"
+    },
+    "user_id": {
+      "type": "integer"
+    }
+  },
+  "required": [
+    "success",
+    "active",
+    "message"
+  ]
+}
diff --git a/spec/requests/api/schemas/json/user_get_response.json b/spec/requests/api/schemas/json/user_get_response.json
new file mode 100644
index 0000000..b2a18ca
--- /dev/null
+++ b/spec/requests/api/schemas/json/user_get_response.json
@@ -0,0 +1,897 @@
+{
+  "additionalProperties": false,
+  "properties": {
+    "user_badges": {
+      "type": "array",
+      "items": [
+
+      ]
+    },
+    "user": {
+      "type": "object",
+      "additionalProperties": false,
+      "properties": {
+        "id": {
+          "type": "integer"
+        },
+        "username": {
+          "type": "string"
+        },
+        "name": {
+          "type": "string"
+        },
+        "avatar_template": {
+          "type": "string"
+        },
+        "last_posted_at": {
+          "type": [
+            "string",
+            "null"
+          ]
+        },
+        "last_seen_at": {
+          "type": [
+            "string",
+            "null"
+          ]
+        },
+        "created_at": {
+          "type": "string"
+        },
+        "ignored": {
+          "type": "boolean"
+        },
+        "muted": {
+          "type": "boolean"
+        },
+        "can_ignore_user": {
+          "type": "boolean"
+        },
+        "can_mute_user": {
+          "type": "boolean"
+        },
+        "can_send_private_messages": {
+          "type": "boolean"
+        },
+        "can_send_private_message_to_user": {
+          "type": "boolean"
+        },
+        "trust_level": {
+          "type": "integer"
+        },
+        "moderator": {
+          "type": "boolean"
+        },
+        "admin": {
+          "type": "boolean"
+        },
+        "title": {
+          "type": [
+            "string",
+            "null"
+          ]
+        },
+        "badge_count": {
+          "type": "integer"
+        },
+        "email": {
+          "type": "string"
+        },
+        "secondary_emails": {
+          "type": "array"
+        },
+        "unconfirmed_emails": {
+          "type": "array"
+        },
+        "associated_accounts": {
+          "type": "array"
+        },
+        "second_factor_backup_enabled": {
+          "type": "boolean"
+        },
+        "user_fields": {
+          "type": "object",
+          "additionalProperties": false,
+          "properties": {
+            "1": {
+              "type": [
+                "string",
+                "null"
+              ]
+            },
+            "2": {
+              "type": [
+                "string",
+                "null"
+              ]
+            }
+          },
+          "required": [
+            "1",
+            "2"
+          ]
+        },
+        "custom_fields": {
+          "type": "object",
+          "additionalProperties": false,
+          "properties": {
+            "first_name": {
+              "type": [
+                "string",
+                "null"
+              ]
+            }
+          },
+          "required": [
+          ]
+        },
+        "time_read": {
+          "type": "integer"
+        },
+        "recent_time_read": {
+          "type": "integer"
+        },
+        "primary_group_id": {
+          "type": [
+            "string",
+            "null"
+          ]
+        },
+        "primary_group_name": {
+          "type": [
+            "string",
+            "null"
+          ]
+        },
+        "flair_group_id": {
+          "type": [
+            "string",
+            "null"
+          ]
+        },
+        "flair_name": {
+          "type": [
+            "string",
+            "null"
+          ]
+        },
+        "flair_url": {
+          "type": [
+            "string",
+            "null"
+          ]
+        },
+        "flair_bg_color": {
+          "type": [
+            "string",
+            "null"
+          ]
+        },
+        "flair_color": {
+          "type": [
+            "string",
+            "null"
+          ]
+        },
+        "featured_topic": {
+          "type": [
+            "string",
+            "null"
+          ]
+        },
+        "staged": {
+          "type": "boolean"
+        },
+        "can_edit": {
+          "type": "boolean"
+        },
+        "can_edit_username": {
+          "type": "boolean"
+        },
+        "can_edit_email": {
+          "type": "boolean"
+        },
+        "can_edit_name": {
+          "type": "boolean"
+        },
+        "uploaded_avatar_id": {
+          "type": [
+            "string",
+            "null"
+          ]
+        },
+        "has_title_badges": {
+          "type": "boolean"
+        },
+        "pending_count": {
+          "type": "integer"
+        },
+        "profile_view_count": {
+          "type": "integer"
+        },
+        "second_factor_enabled": {
+          "type": "boolean"
+        },
+        "can_upload_profile_header": {
+          "type": "boolean"
+        },
+        "can_upload_user_card_background": {
+          "type": "boolean"
+        },
+        "post_count": {
+          "type": "integer"
+        },
+        "can_be_deleted": {
+          "type": "boolean"
+        },
+        "can_delete_all_posts": {
+          "type": "boolean"
+        },
+        "locale": {
+          "type": [
+            "string",
+            "null"
+          ]
+        },
+        "muted_category_ids": {
+          "type": "array",
+          "items": [
+
+          ]
+        },
+        "regular_category_ids": {
+          "type": "array",
+          "items": [
+
+          ]
+        },
+        "watched_tags": {
+          "type": "array",
+          "items": [
+
+          ]
+        },
+        "watching_first_post_tags": {
+          "type": "array",
+          "items": [
+
+          ]
+        },
+        "tracked_tags": {
+          "type": "array",
+          "items": [
+
+          ]
+        },
+        "muted_tags": {
+          "type": "array",
+          "items": [
+
+          ]
+        },
+        "tracked_category_ids": {
+          "type": "array",
+          "items": [
+
+          ]
+        },
+        "watched_category_ids": {
+          "type": "array",
+          "items": [
+
+          ]
+        },
+        "watched_first_post_category_ids": {
+          "type": "array",
+          "items": [
+
+          ]
+        },
+        "system_avatar_upload_id": {
+          "type": [
+            "string",
+            "null"
+          ]
+        },
+        "system_avatar_template": {
+          "type": "string"
+        },
+        "muted_usernames": {
+          "type": "array",
+          "items": [
+
+          ]

[... diff too long, it was truncated ...]

GitHub sha: 4a4881613bd38c575bb0552fa4b286e1c279de90

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