Skip to content

A platform for community discussion. Free, open, simple.

DEV: Update category api docs (#12017)

Blake Erickson65a0d5bd76d0
diff --git a/spec/requests/api/categories_spec.rb b/spec/requests/api/categories_spec.rb
index f14335f1ecc..938f110211c 100644
--- a/spec/requests/api/categories_spec.rb
+++ b/spec/requests/api/categories_spec.rb
@@ -16,406 +16,110 @@ describe 'categories' do
post 'Creates a category' do
tags 'Categories'
consumes 'application/json'
- parameter name: :category, in: :body, schema: {
- type: :object,
- properties: {
- name: { type: :string },
- color: { type: :string },
- text_color: { type: :string },
- },
- required: [ 'name', 'color', 'text_color' ]
- }
+ expected_request_schema = load_spec_schema('category_create_request')
+ parameter name: :params, in: :body, schema: expected_request_schema
produces 'application/json'
- response '200', 'category created' do
- schema type: :object, properties: {
- category: {
- type: :object,
- properties: {
- id: { type: :integer },
- name: { type: :string },
- color: { type: :string },
- text_color: { type: :string },
- slug: { type: :string },
- topic_count: { type: :integer },
- post_count: { type: :integer },
- position: { type: :integer },
- description: { type: :string, nullable: true },
- description_text: { type: :string, nullable: true },
- topic_url: { type: :string },
- read_restricted: { type: :boolean },
- permission: { type: :integer, nullable: true },
- notification_level: { type: :integer, nullable: true },
- can_edit: { type: :boolean },
- topic_template: { type: :string, nullable: true },
- has_children: { type: :boolean, nullable: true },
- sort_order: { type: :string, nullable: true },
- show_subcategory_list: { type: :boolean },
- num_featured_topics: { type: :integer },
- default_view: { type: :string, nullable: true },
- subcategory_list_style: { type: :string },
- default_topic_period: { type: :string },
- minimum_required_tags: { type: :integer },
- navigate_to_first_post_after_read: { type: :boolean },
- custom_fields: { type: :object },
- min_tags_from_required_group: { type: :integer },
- required_tag_group_name: { type: :string, nullable: true },
- available_groups: { type: :array },
- auto_close_hours: { type: :integer, nullable: true },
- auto_close_based_on_last_post: { type: :boolean },
- group_permissions: { type: :array },
- email_in: { type: :boolean, nullable: true },
- email_in_allow_strangers: { type: :boolean },
- mailinglist_mirror: { type: :boolean },
- all_topics_wiki: { type: :boolean },
- can_delete: { type: :boolean },
- cannot_delete_reason: { type: :string, nullable: true },
- allow_badges: { type: :boolean },
- topic_featured_link_allowed: { type: :boolean },
- search_priority: { type: :integer },
- uploaded_logo: { type: :string, nullable: true },
- uploaded_background: { type: :string, nullable: true },
- },
- required: ["id"]
- }
- }, required: ["category"]
+ response '200', 'success response' do
+ expected_response_schema = load_spec_schema('category_create_response')
+ schema expected_response_schema
- let(:category) { { name: 'todo', color: 'f94cb0', text_color: '412763' } }
- run_test!
+ let(:params) { { 'name' => 'todo' } }
+
+ 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
get 'Retreives a list of categories' do
tags 'Categories'
- produces 'application/json'
+ consumes 'application/json'
+ expected_request_schema = nil
- response '200', 'categories response' do
- schema type: :object, properties: {
- category_list: {
- type: :object,
- properties: {
- can_create_category: { type: :boolean },
- can_create_topic: { type: :boolean },
- draft: { type: :string, nullable: true },
- draft_key: { type: :string },
- draft_sequence: { type: :integer },
- categories: {
- type: :array,
- items: {
- type: :object,
- properties: {
- id: { type: :integer },
- name: { type: :string },
- color: { type: :string },
- text_color: { type: :string },
- slug: { type: :string },
- topic_count: { type: :integer },
- post_count: { type: :integer },
- position: { type: :integer },
- description: { type: :string, nullable: true },
- description_text: { type: :string, nullable: true },
- topic_url: { type: :string, nullable: true },
- read_restricted: { type: :boolean },
- permission: { type: :integer, nullable: true },
- notification_level: { type: :integer, nullable: true },
- can_edit: { type: :boolean },
- topic_template: { type: :string, nullable: true },
- has_children: { type: :boolean, nullable: true },
- sort_order: { type: :string, nullable: true },
- show_subcategory_list: { type: :boolean },
- num_featured_topics: { type: :integer },
- default_view: { type: :string, nullable: true },
- subcategory_list_style: { type: :string },
- default_topic_period: { type: :string },
- minimum_required_tags: { type: :integer },
- navigate_to_first_post_after_read: { type: :boolean },
- topics_day: { type: :integer },
- topics_week: { type: :integer },
- topics_month: { type: :integer },
- topics_year: { type: :integer },
- topics_all_time: { type: :integer },
- uploaded_logo: { type: :string, nullable: true },
- uploaded_background: { type: :string, nullable: true },
- }
- }
- },
- }, required: ["categories"]
- }
- }, required: ["category_list"]
- run_test!
+ produces 'application/json'
+ response '200', 'success response' do
+ expected_response_schema = load_spec_schema('category_list_response')
+ schema expected_response_schema
+
+ 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 '/categories/{category_id}.json' do
+ path '/categories/{id}.json' do
put 'Updates a category' do
tags 'Categories'
consumes 'application/json'
- parameter name: :category_id, in: :path, schema: { type: :string }
- parameter name: :category, in: :body, schema: {
- type: :object,
- properties: {
- name: { type: :string },
- color: { type: :string },
- text_color: { type: :string },
- },
- required: [ 'name', 'color', 'text_color' ]
- }
+ expected_request_schema = load_spec_schema('category_create_request')
+ parameter name: :id, in: :path, schema: { type: :integer }
+ parameter name: :params, in: :body, schema: expected_request_schema
produces 'application/json'
- response '200', 'category created' do
- schema type: :object, properties: {
- success: { type: :string },
- category: {
- type: :object,
- properties: {
- id: { type: :integer },
- name: { type: :string },
- color: { type: :string },
- text_color: { type: :string },
- slug: { type: :string },
- topic_count: { type: :integer },
- post_count: { type: :integer },
- position: { type: :integer },
- description: { type: :string, nullable: true },
- description_text: { type: :string, nullable: true },
- description_excerpt: { type: :string, nullable: true },
- topic_url: { type: :string, nullable: true },
- read_restricted: { type: :boolean },
- permission: { type: :string, nullable: true },
- notification_level: { type: :integer, nullable: true },
- can_edit: { type: :boolean },
- topic_template: { type: :string, nullable: true },
- has_children: { type: :string, nullable: true },
- sort_order: { type: :string, nullable: true },
- sort_ascending: { type: :string, nullable: true },
- show_subcategory_list: { type: :boolean },
- num_featured_topics: { type: :integer },
- default_view: { type: :string, nullable: true },
- subcategory_list_style: { type: :string },
- default_top_period: { type: :string },
- default_list_filter: { type: :string },
- minimum_required_tags: { type: :integer },
- navigate_to_first_post_after_read: { type: :boolean },
- custom_fields: {
- type: :object,
- properties: {
- }
- },
- min_tags_from_required_group: { type: :integer },
- required_tag_group_name: { type: :string, nullable: true },
- available_groups: {
- type: :array,
- items: {
- },
- },
- auto_close_hours: { type: :string, nullable: true },
- auto_close_based_on_last_post: { type: :boolean },
- group_permissions: {
- type: :array,
- items: {
- type: :object,
- properties: {
- permission_type: { type: :integer },
- group_name: { type: :string },
- }
- },
- },
- email_in: { type: :string, nullable: true },
- email_in_allow_strangers: { type: :boolean },
- mailinglist_mirror: { type: :boolean },
- all_topics_wiki: { type: :boolean },
- can_delete: { type: :boolean },
- cannot_delete_reason: { type: :string, nullable: true },
- allow_badges: { type: :boolean },
- topic_featured_link_allowed: { type: :boolean },
- search_priority: { type: :integer },
- uploaded_logo: { type: :string, nullable: true },
- uploaded_background: { type: :string, nullable: true },
- }
- },
- }
+ response '200', 'success response' do
+ expected_response_schema = load_spec_schema('category_update_response')
+ schema expected_response_schema
- let(:category_id) { category.id }
- run_test!
+ let(:id) { category.id }
+ let(:params) { { 'name' => 'todo' } }
+
+ 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 '/c/{category_slug}/{category_id}.json' do
+ path '/c/{slug}/{id}.json' do
get 'List topics' do
tags 'Categories'
produces 'application/json'
- parameter name: :category_slug, in: :path, schema: { type: :string }
- parameter name: :category_id, in: :path, schema: { type: :integer }
+ parameter name: :slug, in: :path, schema: { type: :string }
+ parameter name: :id, in: :path, schema: { type: :integer }
+ expected_request_schema = nil
- response '200', 'response' do
- schema type: :object, properties: {
- users: {
- type: :array,
- items: {
- type: :object,
- properties: {
- id: { type: :integer },
- username: { type: :string },
- name: { type: :string, nullable: true },
- avatar_template: { type: :string },
- }
- }
- },
- primary_groups: {
- type: :array
- },
- topic_list: {
- type: :object,
- properties: {
- can_create_topic: { type: :boolean },
- draft: { type: :string, nullable: true },
- draft_key: { type: :string },
- draft_sequence: { type: :integer },
- per_page: { type: :integer },
- topics: {
- type: :array,
- items: {
- type: :object,
- properties: {
- id: { type: :integer },
- title: { type: :string },
- fancy_title: { type: :string },
- slug: { type: :string },
- posts_count: { type: :integer },
- reply_count: { type: :integer },
- highest_post_number: { type: :integer },
- image_url: { type: :string, nullable: true },
- created_at: { type: :string },
- last_posted_at: { type: :string },
- bumped: { type: :boolean },
- bumped_at: { type: :string },
- archetype: { type: :string },
- unseen: { type: :boolean },
- pinned: { type: :boolean },
- unpinned: { type: :boolean, nullable: true },
- excerpt: { type: :string },
- visible: { type: :boolean },
- closed: { type: :boolean },
- archived: { type: :boolean },
- bookmarked: { type: :boolean, nullable: true },
- liked: { type: :boolean, nullable: true },
- views: { type: :integer },
- like_count: { type: :integer },
- has_summary: { type: :boolean },
- last_poster_username: { type: :string },
- category_id: { type: :integer },
- op_like_count: { type: :integer },
- pinned_globally: { type: :boolean },
- featured_link: { type: :string, nullable: true },
- posters: {
- type: :array,
- items: {
- type: :object,
- properties: {
- extras: { type: :string },
- description: { type: :string },
- user_id: { type: :integer },
- primary_group_id: { type: :integer, nullable: true },
- }
- }
- }
- }
- }
- }
- }
- }
- }
- let(:category_id) { category.id }
- let(:category_slug) { category.slug_path.join("/") }
- run_test!
+ produces 'application/json'
+ response '200', 'success response' do
+ expected_response_schema = load_spec_schema('category_topics_response')
+ schema expected_response_schema
+
+ let(:id) { category.id }
+ let(:slug) { category.slug_path.join("/") }
+
+ 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 '/c/{category_id}/show.json' do
+ path '/c/{id}/show.json' do
get 'Show category' do
tags 'Categories'
- produces 'application/json'
- parameter name: :category_id, in: :path, schema: { type: :string }
+ consumes 'application/json'
+ parameter name: :id, in: :path, schema: { type: :integer }
+ expected_request_schema = nil
+ produces 'application/json'
response '200', 'response' do
- schema type: :object, properties: {
- category: {
- type: :object,
- properties: {
- id: { type: :integer },
- name: { type: :string },
- color: { type: :string },
- text_color: { type: :string },
- slug: { type: :string },
- topic_count: { type: :integer },
- post_count: { type: :integer },
- position: { type: :integer },
- description: { type: :string, nullable: true },
- description_text: { type: :string, nullable: true },
- description_excerpt: { type: :string, nullable: true },
- topic_url: { type: :string, nullable: true },
- read_restricted: { type: :boolean },
- permission: { type: :integer },
- notification_level: { type: :integer, nullable: true },
- can_edit: { type: :boolean },
- topic_template: { type: :string, nullable: true },
- has_children: { type: :string, nullable: true },
- sort_order: { type: :string, nullable: true },
- sort_ascending: { type: :string, nullable: true },
- show_subcategory_list: { type: :boolean },
- num_featured_topics: { type: :integer },
- default_view: { type: :string, nullable: true },
- subcategory_list_style: { type: :string },
- default_top_period: { type: :string },
- default_list_filter: { type: :string },
- minimum_required_tags: { type: :integer },
- navigate_to_first_post_after_read: { type: :boolean },
- custom_fields: {
- type: :object,
- properties: {
- }
- },
- min_tags_from_required_group: { type: :integer },
- required_tag_group_name: { type: :string, nullable: true },
- available_groups: {
- type: :array,
- items: {
- },
- },
- auto_close_hours: { type: :string, nullable: true },
- auto_close_based_on_last_post: { type: :boolean },
- group_permissions: {
- type: :array,
- items: {
- type: :object,
- properties: {
- permission_type: { type: :integer },
- group_name: { type: :string },
- }
- },
- },
- email_in: { type: :string, nullable: true },
- email_in_allow_strangers: { type: :boolean },
- mailinglist_mirror: { type: :boolean },
- all_topics_wiki: { type: :boolean },
- can_delete: { type: :boolean },
- cannot_delete_reason: { type: :string, nullable: true },
- allow_badges: { type: :boolean },
- topic_featured_link_allowed: { type: :boolean },
- search_priority: { type: :integer },
- uploaded_logo: { type: :string, nullable: true },
- uploaded_background: { type: :string, nullable: true },
- }
- },
- }
- let(:category_id) { category.id }
- run_test!
+ expected_response_schema = load_spec_schema('category_create_response')
+ schema expected_response_schema
+
+ let(:id) { category.id }
+
+ 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
diff --git a/spec/requests/api/schemas/json/category_create_request.json b/spec/requests/api/schemas/json/category_create_request.json
new file mode 100644
index 00000000000..57af4b7b1a4
--- /dev/null
+++ b/spec/requests/api/schemas/json/category_create_request.json
@@ -0,0 +1,19 @@
+{
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "color": {
+ "type": "string",
+ "example": "49d9e9"
+ },
+ "text_color": {
+ "type": "string",
+ "example": "f0fcfd"
+ }
+ },
+ "required": [
+ "name"
+ ]
+}
diff --git a/spec/requests/api/schemas/json/category_create_response.json b/spec/requests/api/schemas/json/category_create_response.json
new file mode 100644
index 00000000000..b056f0365aa
--- /dev/null
+++ b/spec/requests/api/schemas/json/category_create_response.json
@@ -0,0 +1,282 @@
+{
+ "additionalProperties": false,
+ "properties": {
+ "category": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ },
+ "color": {
+ "type": "string"
+ },
+ "text_color": {
+ "type": "string"
+ },
+ "slug": {
+ "type": "string"
+ },
+ "topic_count": {
+ "type": "integer"
+ },
+ "post_count": {
+ "type": "integer"
+ },
+ "position": {
+ "type": "integer"
+ },
+ "description": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "description_text": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "description_excerpt": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "topic_url": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "read_restricted": {
+ "type": "boolean"
+ },
+ "permission": {
+ "type": [
+ "integer",
+ "null"
+ ]
+ },
+ "notification_level": {
+ "type": "integer"
+ },
+ "can_edit": {
+ "type": "boolean"
+ },
+ "topic_template": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "has_children": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "sort_order": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "sort_ascending": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "show_subcategory_list": {
+ "type": "boolean"
+ },
+ "num_featured_topics": {
+ "type": "integer"
+ },
+ "default_view": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "subcategory_list_style": {
+ "type": "string"
+ },
+ "default_top_period": {
+ "type": "string"
+ },
+ "default_list_filter": {
+ "type": "string"
+ },
+ "minimum_required_tags": {
+ "type": "integer"
+ },
+ "navigate_to_first_post_after_read": {
+ "type": "boolean"
+ },
+ "custom_fields": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ },
+ "required": [
+
+ ]
+ },
+ "min_tags_from_required_group": {
+ "type": "integer"
+ },
+ "required_tag_group_name": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "read_only_banner": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "available_groups": {
+ "type": "array",
+ "items": [
+
+ ]
+ },
+ "auto_close_hours": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "auto_close_based_on_last_post": {
+ "type": "boolean"
+ },
+ "group_permissions": {
+ "type": "array",
+ "items": [
+ {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "permission_type": {
+ "type": "integer"
+ },
+ "group_name": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "permission_type",
+ "group_name"
+ ]
+ }
+ ]
+ },
+ "email_in": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "email_in_allow_strangers": {
+ "type": "boolean"
+ },
+ "mailinglist_mirror": {
+ "type": "boolean"
+ },
+ "all_topics_wiki": {
+ "type": "boolean"
+ },
+ "can_delete": {
+ "type": "boolean"
+ },
+ "cannot_delete_reason": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "allow_badges": {
+ "type": "boolean"
+ },
+ "topic_featured_link_allowed": {
+ "type": "boolean"
+ },
+ "search_priority": {
+ "type": "integer"
+ },
+ "uploaded_logo": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "uploaded_background": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "id",
+ "name",
+ "color",
+ "text_color",
+ "slug",
+ "topic_count",
+ "post_count",
+ "position",
+ "description",
+ "description_text",
+ "description_excerpt",
+ "topic_url",
+ "read_restricted",
+ "permission",
+ "notification_level",
+ "can_edit",
+ "topic_template",
+ "has_children",
+ "sort_order",
+ "sort_ascending",
+ "show_subcategory_list",
+ "num_featured_topics",
+ "default_view",
+ "subcategory_list_style",
+ "default_top_period",
+ "default_list_filter",
+ "minimum_required_tags",
+ "navigate_to_first_post_after_read",
+ "custom_fields",
+ "min_tags_from_required_group",
+ "required_tag_group_name",
+ "read_only_banner",
+ "available_groups",
+ "auto_close_hours",
+ "auto_close_based_on_last_post",
+ "group_permissions",
+ "email_in",
+ "email_in_allow_strangers",
+ "mailinglist_mirror",
+ "all_topics_wiki",
+ "can_delete",
+ "cannot_delete_reason",
+ "allow_badges",
+ "topic_featured_link_allowed",
+ "search_priority",
+ "uploaded_logo",
+ "uploaded_background"
+ ]
+ }
+ },
+ "required": [
+ "category"
+ ]
+}
diff --git a/spec/requests/api/schemas/json/category_list_response.json b/spec/requests/api/schemas/json/category_list_response.json
new file mode 100644
index 00000000000..e4a7fa57424
--- /dev/null
+++ b/spec/requests/api/schemas/json/category_list_response.json
@@ -0,0 +1,222 @@
+{
+ "additionalProperties": false,
+ "properties": {
+ "category_list": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "can_create_category": {
+ "type": "boolean"
+ },
+ "can_create_topic": {
+ "type": "boolean"
+ },
+ "draft": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "draft_key": {
+ "type": "string"
+ },
+ "draft_sequence": {
+ "type": "integer"
+ },
+ "categories": {
+ "type": "array",
+ "items": [
+ {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ },
+ "color": {
+ "type": "string"
+ },
+ "text_color": {
+ "type": "string"
+ },
+ "slug": {
+ "type": "string"
+ },
+ "topic_count": {
+ "type": "integer"
+ },
+ "post_count": {
+ "type": "integer"
+ },
+ "position": {
+ "type": "integer"
+ },
+ "description": {
+ "type": "string"
+ },
+ "description_text": {
+ "type": "string"
+ },
+ "description_excerpt": {
+ "type": "string"
+ },
+ "topic_url": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "read_restricted": {
+ "type": "boolean"
+ },
+ "permission": {
+ "type": "integer"
+ },
+ "notification_level": {
+ "type": "integer"
+ },
+ "can_edit": {
+ "type": "boolean"
+ },
+ "topic_template": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "has_children": {
+ "type": "boolean"
+ },
+ "sort_order": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "sort_ascending": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "show_subcategory_list": {
+ "type": "boolean"
+ },
+ "num_featured_topics": {
+ "type": "integer"
+ },
+ "default_view": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "subcategory_list_style": {
+ "type": "string"
+ },
+ "default_top_period": {
+ "type": "string"
+ },
+ "default_list_filter": {
+ "type": "string"
+ },
+ "minimum_required_tags": {
+ "type": "integer"
+ },
+ "navigate_to_first_post_after_read": {
+ "type": "boolean"
+ },
+ "topics_day": {
+ "type": "integer"
+ },
+ "topics_week": {
+ "type": "integer"
+ },
+ "topics_month": {
+ "type": "integer"
+ },
+ "topics_year": {
+ "type": "integer"
+ },
+ "topics_all_time": {
+ "type": "integer"
+ },
+ "is_uncategorized": {
+ "type": "boolean"
+ },
+ "subcategory_ids": {
+ "type": "array",
+ "items": [
+
+ ]
+ },
+ "uploaded_logo": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "uploaded_background": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "id",
+ "name",
+ "color",
+ "text_color",
+ "slug",
+ "topic_count",
+ "post_count",
+ "position",
+ "description",
+ "description_text",
+ "description_excerpt",
+ "topic_url",
+ "read_restricted",
+ "permission",
+ "notification_level",
+ "can_edit",
+ "topic_template",
+ "has_children",
+ "sort_order",
+ "sort_ascending",
+ "show_subcategory_list",
+ "num_featured_topics",
+ "default_view",
+ "subcategory_list_style",
+ "default_top_period",
+ "default_list_filter",
+ "minimum_required_tags",
+ "navigate_to_first_post_after_read",
+ "topics_day",
+ "topics_week",
+ "topics_month",
+ "topics_year",
+ "topics_all_time",
+ "is_uncategorized",
+ "subcategory_ids",
+ "uploaded_logo",
+ "uploaded_background"
+ ]
+ }
+ ]
+ }
+ },
+ "required": [
+ "can_create_category",
+ "can_create_topic",
+ "categories"
+ ]
+ }
+ },
+ "required": [
+ "category_list"
+ ]
+}
diff --git a/spec/requests/api/schemas/json/category_topics_response.json b/spec/requests/api/schemas/json/category_topics_response.json
new file mode 100644
index 00000000000..772d42b1653
--- /dev/null
+++ b/spec/requests/api/schemas/json/category_topics_response.json
@@ -0,0 +1,252 @@
+{
+ "additionalProperties": false,
+ "properties": {
+ "users": {
+ "type": "array",
+ "items": [
+ {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "username": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "avatar_template": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "id",
+ "username",
+ "name",
+ "avatar_template"
+ ]
+ }
+ ]
+ },
+ "primary_groups": {
+ "type": "array",
+ "items": [
+
+ ]
+ },
+ "topic_list": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "can_create_topic": {
+ "type": "boolean"
+ },
+ "draft": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "draft_key": {
+ "type": "string"
+ },
+ "draft_sequence": {
+ "type": "integer"
+ },
+ "per_page": {
+ "type": "integer"
+ },
+ "topics": {
+ "type": "array",
+ "items": [
+ {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "title": {
+ "type": "string"
+ },
+ "fancy_title": {
+ "type": "string"
+ },
+ "slug": {
+ "type": "string"
+ },
+ "posts_count": {
+ "type": "integer"
+ },
+ "reply_count": {
+ "type": "integer"
+ },
+ "highest_post_number": {
+ "type": "integer"
+ },
+ "image_url": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "created_at": {
+ "type": "string"
+ },
+ "last_posted_at": {
+ "type": "string"
+ },
+ "bumped": {
+ "type": "boolean"
+ },
+ "bumped_at": {
+ "type": "string"
+ },
+ "archetype": {
+ "type": "string"
+ },
+ "unseen": {
+ "type": "boolean"
+ },
+ "pinned": {
+ "type": "boolean"
+ },
+ "unpinned": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "excerpt": {
+ "type": "string"
+ },
+ "visible": {
+ "type": "boolean"
+ },
+ "closed": {
+ "type": "boolean"
+ },
+ "archived": {
+ "type": "boolean"
+ },
+ "bookmarked": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "liked": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "views": {
+ "type": "integer"
+ },
+ "like_count": {
+ "type": "integer"
+ },
+ "has_summary": {
+ "type": "boolean"
+ },
+ "last_poster_username": {
+ "type": "string"
+ },
+ "category_id": {
+ "type": "integer"
+ },
+ "pinned_globally": {
+ "type": "boolean"
+ },
+ "featured_link": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "posters": {
+ "type": "array",
+ "items": [
+ {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "extras": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ },
+ "user_id": {
+ "type": "integer"
+ },
+ "primary_group_id": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "extras",
+ "description",
+ "user_id",
+ "primary_group_id"
+ ]
+ }
+ ]
+ }
+ },
+ "required": [
+ "id",
+ "title",
+ "fancy_title",
+ "slug",
+ "posts_count",
+ "reply_count",
+ "highest_post_number",
+ "image_url",
+ "created_at",
+ "last_posted_at",
+ "bumped",
+ "bumped_at",
+ "archetype",
+ "unseen",
+ "pinned",
+ "unpinned",
+ "excerpt",
+ "visible",
+ "closed",
+ "archived",
+ "bookmarked",
+ "liked",
+ "views",
+ "like_count",
+ "has_summary",
+ "last_poster_username",
+ "category_id",
+ "pinned_globally",
+ "featured_link",
+ "posters"
+ ]
+ }
+ ]
+ }
+ },
+ "required": [
+ "can_create_topic",
+ "draft",
+ "draft_key",
+ "draft_sequence",
+ "per_page",
+ "topics"
+ ]
+ }
+ },
+ "required": [
+ "topic_list"
+ ]
+}
diff --git a/spec/requests/api/schemas/json/category_update_response.json b/spec/requests/api/schemas/json/category_update_response.json
new file mode 100644
index 00000000000..0e5220d263f
--- /dev/null
+++ b/spec/requests/api/schemas/json/category_update_response.json
@@ -0,0 +1,286 @@
+{
+ "additionalProperties": false,
+ "properties": {
+ "success": {
+ "type": "string"
+ },
+ "category": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ },
+ "color": {
+ "type": "string"
+ },
+ "text_color": {
+ "type": "string"
+ },
+ "slug": {
+ "type": "string"
+ },
+ "topic_count": {
+ "type": "integer"
+ },
+ "post_count": {
+ "type": "integer"
+ },
+ "position": {
+ "type": "integer"
+ },
+ "description": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "description_text": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "description_excerpt": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "topic_url": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "read_restricted": {
+ "type": "boolean"
+ },
+ "permission": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "notification_level": {
+ "type": "integer"
+ },
+ "can_edit": {
+ "type": "boolean"
+ },
+ "topic_template": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "has_children": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "sort_order": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "sort_ascending": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "show_subcategory_list": {
+ "type": "boolean"
+ },
+ "num_featured_topics": {
+ "type": "integer"
+ },
+ "default_view": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "subcategory_list_style": {
+ "type": "string"
+ },
+ "default_top_period": {
+ "type": "string"
+ },
+ "default_list_filter": {
+ "type": "string"
+ },
+ "minimum_required_tags": {
+ "type": "integer"
+ },
+ "navigate_to_first_post_after_read": {
+ "type": "boolean"
+ },
+ "custom_fields": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ },
+ "required": [
+
+ ]
+ },
+ "min_tags_from_required_group": {
+ "type": "integer"
+ },
+ "required_tag_group_name": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "read_only_banner": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "available_groups": {
+ "type": "array",
+ "items": [
+
+ ]
+ },
+ "auto_close_hours": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "auto_close_based_on_last_post": {
+ "type": "boolean"
+ },
+ "group_permissions": {
+ "type": "array",
+ "items": [
+ {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "permission_type": {
+ "type": "integer"
+ },
+ "group_name": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "permission_type",
+ "group_name"
+ ]
+ }
+ ]
+ },
+ "email_in": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "email_in_allow_strangers": {
+ "type": "boolean"
+ },
+ "mailinglist_mirror": {
+ "type": "boolean"
+ },
+ "all_topics_wiki": {
+ "type": "boolean"
+ },
+ "can_delete": {
+ "type": "boolean"
+ },
+ "cannot_delete_reason": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "allow_badges": {
+ "type": "boolean"
+ },
+ "topic_featured_link_allowed": {
+ "type": "boolean"
+ },
+ "search_priority": {
+ "type": "integer"
+ },
+ "uploaded_logo": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "uploaded_background": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "id",
+ "name",
+ "color",
+ "text_color",
+ "slug",
+ "topic_count",
+ "post_count",
+ "position",
+ "description",
+ "description_text",
+ "description_excerpt",
+ "topic_url",
+ "read_restricted",
+ "permission",
+ "notification_level",
+ "can_edit",
+ "topic_template",
+ "has_children",
+ "sort_order",
+ "sort_ascending",
+ "show_subcategory_list",
+ "num_featured_topics",
+ "default_view",
+ "subcategory_list_style",
+ "default_top_period",
+ "default_list_filter",
+ "minimum_required_tags",
+ "navigate_to_first_post_after_read",
+ "custom_fields",
+ "min_tags_from_required_group",
+ "required_tag_group_name",
+ "read_only_banner",
+ "available_groups",
+ "auto_close_hours",
+ "auto_close_based_on_last_post",
+ "group_permissions",
+ "email_in",
+ "email_in_allow_strangers",
+ "mailinglist_mirror",
+ "all_topics_wiki",
+ "can_delete",
+ "cannot_delete_reason",
+ "allow_badges",
+ "topic_featured_link_allowed",
+ "search_priority",
+ "uploaded_logo",
+ "uploaded_background"
+ ]
+ }
+ },
+ "required": [
+ "success",
+ "category"
+ ]
+}