diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index 9afe31d083abf636b1313b8798107884aaa6c9ff..f06fe55922e5cdb51ddf97a913089ac6781d87ff 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/changelogs/unreleased/project-topics-graphql-migration.yml b/changelogs/unreleased/project-topics-graphql-migration.yml new file mode 100644 index 0000000000000000000000000000000000000000..c1b108563ceaedac7506d8b6f60b38f4d8677340 --- /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 diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index a1c397890ef7eab581a4d3c6ffffa1c7ceaca0eb..9c02401fcae9648bb1d7957c6aefaaffcca7549b 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 3ef2fbba002fa4cd090880bafc9f81bb10a568db..0f7cadbd4a7f57575e95bd554a3fac74a9b85c8f 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 diff --git a/spec/requests/api/graphql/project_query_spec.rb b/spec/requests/api/graphql/project_query_spec.rb index 2cdd7273b18a0deedc44da8c50afbe9b049eda9b..b367bbaaf436b2850e38b279dff3a84c2b4e1708 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)