Skip to content

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

DEV: Update tag_groups api doc schema (#35520)

Blake Erickson737c4ea19471
diff --git a/spec/requests/api/schemas/json/tag_groups_list_response.json b/spec/requests/api/schemas/json/tag_groups_list_response.json
new file mode 100644
index 00000000000..22e85a7e6da
--- /dev/null
+++ b/spec/requests/api/schemas/json/tag_groups_list_response.json
@@ -0,0 +1,52 @@
+{
+ "additionalProperties": false,
+ "properties": {
+ "tag_groups": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ },
+ "tag_names": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "parent_tag_name": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "one_per_topic": {
+ "type": "boolean"
+ },
+ "permissions": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "integer"
+ }
+ }
+ },
+ "required": [
+ "id",
+ "name",
+ "tag_names",
+ "parent_tag_name",
+ "one_per_topic",
+ "permissions"
+ ]
+ }
+ }
+ },
+ "required": [
+ "tag_groups"
+ ]
+}
\ No newline at end of file
diff --git a/spec/requests/api/tags_spec.rb b/spec/requests/api/tags_spec.rb
index 218adcdcc21..11c2f6fd70f 100644
--- a/spec/requests/api/tags_spec.rb
+++ b/spec/requests/api/tags_spec.rb
@@ -19,46 +19,13 @@ RSpec.describe "tags" do
produces "application/json"
response "200", "tags" do
- schema type: :object,
- properties: {
- tag_groups: {
- type: :array,
- items: {
- type: :object,
- properties: {
- id: {
- type: :integer,
- },
- name: {
- type: :string,
- },
- tag_names: {
- type: :array,
- items: {
- },
- },
- parent_tag_name: {
- type: :array,
- items: {
- },
- },
- one_per_topic: {
- type: :boolean,
- },
- permissions: {
- type: :object,
- properties: {
- staff: {
- type: :integer,
- },
- },
- },
- },
- },
- },
- }
+ expected_response_schema = load_spec_schema("tag_groups_list_response")
+ schema expected_response_schema
- run_test!
+ it_behaves_like "a JSON endpoint", 200 do
+ let(:expected_response_schema) { expected_response_schema }
+ let(:expected_request_schema) { nil }
+ end
end
end
end