From 27bf6c6ef877c00871d10e71b111ae7a82cc9d5d Mon Sep 17 00:00:00 2001 From: Jonas Waelter Date: Fri, 7 May 2021 15:45:09 +0200 Subject: [PATCH 1/3] Add GraphQL Project.topics instead of Project.tag_list Changelog: deprecated --- app/graphql/types/project_type.rb | 4 ++++ doc/api/graphql/reference/index.md | 3 ++- spec/graphql/types/project_type_spec.rb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index 9afe31d083abf6..f06fe55922e5cd 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -30,8 +30,12 @@ class ProjectType < BaseObject markdown_field :description_html, null: true field :tag_list, GraphQL::STRING_TYPE, null: true, + deprecated: { reason: 'Use `topics`', milestone: '13.12' }, description: 'List of project topics (not Git tags).' + field :topics, [GraphQL::STRING_TYPE], null: true, + description: 'List of project topics.' + field :ssh_url_to_repo, GraphQL::STRING_TYPE, null: true, description: 'URL to connect to the project via SSH.' field :http_url_to_repo, GraphQL::STRING_TYPE, null: true, diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index a1c397890ef7ea..9c02401fcae964 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -10756,8 +10756,9 @@ Represents vulnerability finding of a security report on the pipeline. | `starCount` | [`Int!`](#int) | Number of times the project has been starred. | | `statistics` | [`ProjectStatistics`](#projectstatistics) | Statistics of the project. | | `suggestionCommitMessage` | [`String`](#string) | The commit message used to apply merge request suggestions. | -| `tagList` | [`String`](#string) | List of project topics (not Git tags). | +| `tagList` **{warning-solid}** | [`String`](#string) | **Deprecated** in 13.12. Use `topics`. | | `terraformStates` | [`TerraformStateConnection`](#terraformstateconnection) | Terraform states associated with the project. (see [Connections](#connections)) | +| `topics` | [`[String!]`](#string) | List of project topics. | | `userPermissions` | [`ProjectPermissions!`](#projectpermissions) | Permissions for the current user on the resource. | | `visibility` | [`String`](#string) | Visibility of the project. | | `vulnerabilityScanners` | [`VulnerabilityScannerConnection`](#vulnerabilityscannerconnection) | Vulnerability scanners reported on the project vulnerabilities. (see [Connections](#connections)) | diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb index 3ef2fbba002fa4..0f7cadbd4a7f57 100644 --- a/spec/graphql/types/project_type_spec.rb +++ b/spec/graphql/types/project_type_spec.rb @@ -14,7 +14,7 @@ it 'has the expected fields' do expected_fields = %w[ user_permissions id full_path path name_with_namespace - name description description_html tag_list ssh_url_to_repo + name description description_html tag_list topics ssh_url_to_repo http_url_to_repo web_url star_count forks_count created_at last_activity_at archived visibility container_registry_enabled shared_runners_enabled -- GitLab From f4e4892be84e301e4272a81239f6f49801f1bcc9 Mon Sep 17 00:00:00 2001 From: Jonas Waelter Date: Fri, 7 May 2021 16:26:14 +0200 Subject: [PATCH 2/3] Add changelog entry --- changelogs/unreleased/project-topics-graphql-migration.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/project-topics-graphql-migration.yml diff --git a/changelogs/unreleased/project-topics-graphql-migration.yml b/changelogs/unreleased/project-topics-graphql-migration.yml new file mode 100644 index 00000000000000..c1b108563ceaed --- /dev/null +++ b/changelogs/unreleased/project-topics-graphql-migration.yml @@ -0,0 +1,5 @@ +--- +title: Add GraphQL field 'Project.topics' and deprecate 'Project.tag_list' +merge_request: 61250 +author: Jonas Wälter @wwwjon +type: deprecated -- GitLab From 742c519fc663ca72888feac2b6f86af29cc518f1 Mon Sep 17 00:00:00 2001 From: Jonas Waelter Date: Mon, 10 May 2021 14:02:56 +0200 Subject: [PATCH 3/3] Add GraphQL specs for Project.topics --- spec/requests/api/graphql/project_query_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/requests/api/graphql/project_query_spec.rb b/spec/requests/api/graphql/project_query_spec.rb index 2cdd7273b18a0d..b367bbaaf436b2 100644 --- a/spec/requests/api/graphql/project_query_spec.rb +++ b/spec/requests/api/graphql/project_query_spec.rb @@ -57,6 +57,22 @@ end end + context 'topics' do + it 'includes empty topics array if no topics set' do + post_graphql(query, current_user: current_user) + + expect(graphql_data_at(:project, :topics)).to match([]) + end + + it 'includes topics array' do + project.update!(tag_list: 'topic1, topic2, topic3') + + post_graphql(query, current_user: current_user) + + expect(graphql_data_at(:project, :topics)).to match(%w[topic1 topic2 topic3]) + end + end + it 'includes inherited members in project_members' do group_member = create(:group_member, group: group) project_member = create(:project_member, project: project) -- GitLab