diff --git a/app/graphql/mutations/todos/mark_all_done.rb b/app/graphql/mutations/todos/mark_all_done.rb index 22a5893d4ec05522b8d7a6fe49eb9b0434cc4b62..7dd06cc8293f026a7c412702cdc3107d5208f5be 100644 --- a/app/graphql/mutations/todos/mark_all_done.rb +++ b/app/graphql/mutations/todos/mark_all_done.rb @@ -7,12 +7,6 @@ class MarkAllDone < ::Mutations::Todos::Base authorize :update_user - field :updated_ids, - [::Types::GlobalIDType[::Todo]], - null: false, - deprecated: { reason: 'Use to-do items', milestone: '13.2' }, - description: 'IDs of the updated to-do items.' - field :todos, [::Types::TodoType], null: false, description: 'Updated to-do items.' @@ -23,7 +17,6 @@ def resolve updated_ids = mark_all_todos_done { - updated_ids: updated_ids, todos: Todo.id_in(updated_ids), errors: [] } diff --git a/app/graphql/mutations/todos/restore_many.rb b/app/graphql/mutations/todos/restore_many.rb index 41ccbd77aa6eb9f8a34f925a61c2ffbf4eb3571c..b09c59a34353f212d930845c2de7910a5d1039a4 100644 --- a/app/graphql/mutations/todos/restore_many.rb +++ b/app/graphql/mutations/todos/restore_many.rb @@ -12,11 +12,6 @@ class RestoreMany < ::Mutations::Todos::Base required: true, description: 'The global IDs of the to-do items to restore (a maximum of 50 is supported at once).' - field :updated_ids, [::Types::GlobalIDType[Todo]], - null: false, - description: 'The IDs of the updated to-do items.', - deprecated: { reason: 'Use to-do items', milestone: '13.2' } - field :todos, [::Types::TodoType], null: false, description: 'Updated to-do items.' diff --git a/app/graphql/types/deprecated_mutations.rb b/app/graphql/types/deprecated_mutations.rb index a4336fa3ef3c544324a3d2241ab6d728a0dc38cd..49bad56b6f92f1e89dd7a49e4db3dd32bb376c9a 100644 --- a/app/graphql/types/deprecated_mutations.rb +++ b/app/graphql/types/deprecated_mutations.rb @@ -5,15 +5,7 @@ module DeprecatedMutations extend ActiveSupport::Concern prepended do - mount_aliased_mutation 'AddAwardEmoji', - Mutations::AwardEmojis::Add, - deprecated: { reason: 'Use awardEmojiAdd', milestone: '13.2' } - mount_aliased_mutation 'RemoveAwardEmoji', - Mutations::AwardEmojis::Remove, - deprecated: { reason: 'Use awardEmojiRemove', milestone: '13.2' } - mount_aliased_mutation 'ToggleAwardEmoji', - Mutations::AwardEmojis::Toggle, - deprecated: { reason: 'Use awardEmojiToggle', milestone: '13.2' } + # placeholder for any FOSS mutations to be deprecated end end end diff --git a/app/graphql/types/snippet_type.rb b/app/graphql/types/snippet_type.rb index 2f79ec48c047600c81d0cfdc2facbfcfa96d339d..34357ead048e18bcf1d50a4f902d9ccb915c8770 100644 --- a/app/graphql/types/snippet_type.rb +++ b/app/graphql/types/snippet_type.rb @@ -61,12 +61,6 @@ class SnippetType < BaseObject description: 'Raw URL of the snippet.', null: false - field :blob, type: Types::Snippets::BlobType, - description: 'Snippet blob.', - calls_gitaly: true, - null: false, - deprecated: { reason: 'Use `blobs`', milestone: '13.3' } - field :blobs, type: Types::Snippets::BlobType.connection_type, description: 'Snippet blobs.', calls_gitaly: true, diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 0822e94e58f1509e3aa1a5aae3741645a1de79ed..d4379499bf67a682bcd0869248b85d83d7813da0 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -455,30 +455,6 @@ four standard [pagination arguments](#connection-pagination-arguments): | <a id="queryvulnerabilitiescountbydayenddate"></a>`endDate` | [`ISO8601Date!`](#iso8601date) | Last day for which to fetch vulnerability history. | | <a id="queryvulnerabilitiescountbydaystartdate"></a>`startDate` | [`ISO8601Date!`](#iso8601date) | First day for which to fetch vulnerability history. | -### `Query.vulnerabilitiesCountByDayAndSeverity` - -Number of vulnerabilities per severity level, per day, for the projects on the -current user's instance security dashboard. -. - -WARNING: -**Deprecated** in 13.3. -Use of this is not recommended. -Use: [`Query.vulnerabilitiesCountByDay`](#queryvulnerabilitiescountbyday). - -Returns [`VulnerabilitiesCountByDayAndSeverityConnection`](#vulnerabilitiescountbydayandseverityconnection). - -This field returns a [connection](#connections). It accepts the -four standard [pagination arguments](#connection-pagination-arguments): -`before: String`, `after: String`, `first: Int`, `last: Int`. - -#### Arguments - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="queryvulnerabilitiescountbydayandseverityenddate"></a>`endDate` | [`ISO8601Date!`](#iso8601date) | Last day for which to fetch vulnerability history. | -| <a id="queryvulnerabilitiescountbydayandseveritystartdate"></a>`startDate` | [`ISO8601Date!`](#iso8601date) | First day for which to fetch vulnerability history. | - ### `Query.vulnerability` Find a vulnerability. @@ -510,30 +486,6 @@ mutation($id: NoteableID!, $body: String!) { } ``` -### `Mutation.addAwardEmoji` - -WARNING: -**Deprecated** in 13.2. -Use awardEmojiAdd. - -Input type: `AddAwardEmojiInput` - -#### Arguments - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="mutationaddawardemojiawardableid"></a>`awardableId` | [`AwardableID!`](#awardableid) | The global ID of the awardable resource. | -| <a id="mutationaddawardemojiclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | -| <a id="mutationaddawardemojiname"></a>`name` | [`String!`](#string) | The emoji name. | - -#### Fields - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="mutationaddawardemojiawardemoji"></a>`awardEmoji` | [`AwardEmoji`](#awardemoji) | The award emoji after mutation. | -| <a id="mutationaddawardemojiclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | -| <a id="mutationaddawardemojierrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | - ### `Mutation.addProjectToSecurityDashboard` Input type: `AddProjectToSecurityDashboardInput` @@ -1485,7 +1437,6 @@ Input type: `DastScannerProfileCreateInput` | ---- | ---- | ----------- | | <a id="mutationdastscannerprofilecreateclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | | <a id="mutationdastscannerprofilecreateerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | -| <a id="mutationdastscannerprofilecreateglobalid"></a>`globalId` **{warning-solid}** | [`DastScannerProfileID`](#dastscannerprofileid) | **Deprecated:** Use `id`. Deprecated in 13.6. | | <a id="mutationdastscannerprofilecreateid"></a>`id` | [`DastScannerProfileID`](#dastscannerprofileid) | ID of the scanner profile. | ### `Mutation.dastScannerProfileDelete` @@ -1943,31 +1894,6 @@ Input type: `DiscussionToggleResolveInput` | <a id="mutationdiscussiontoggleresolvediscussion"></a>`discussion` | [`Discussion`](#discussion) | The discussion after mutation. | | <a id="mutationdiscussiontoggleresolveerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | -### `Mutation.dismissVulnerability` - -WARNING: -**Deprecated** in 13.5. -Use vulnerabilityDismiss. - -Input type: `DismissVulnerabilityInput` - -#### Arguments - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="mutationdismissvulnerabilityclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | -| <a id="mutationdismissvulnerabilitycomment"></a>`comment` | [`String`](#string) | Comment why vulnerability should be dismissed. | -| <a id="mutationdismissvulnerabilitydismissalreason"></a>`dismissalReason` | [`VulnerabilityDismissalReason`](#vulnerabilitydismissalreason) | Reason why vulnerability should be dismissed. | -| <a id="mutationdismissvulnerabilityid"></a>`id` | [`VulnerabilityID!`](#vulnerabilityid) | ID of the vulnerability to be dismissed. | - -#### Fields - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="mutationdismissvulnerabilityclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | -| <a id="mutationdismissvulnerabilityerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | -| <a id="mutationdismissvulnerabilityvulnerability"></a>`vulnerability` | [`Vulnerability`](#vulnerability) | The vulnerability after dismissal. | - ### `Mutation.enableDevopsAdoptionNamespace` **BETA** This endpoint is subject to change without notice. @@ -3513,30 +3439,6 @@ Input type: `ReleaseUpdateInput` | <a id="mutationreleaseupdateerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | | <a id="mutationreleaseupdaterelease"></a>`release` | [`Release`](#release) | The release after mutation. | -### `Mutation.removeAwardEmoji` - -WARNING: -**Deprecated** in 13.2. -Use awardEmojiRemove. - -Input type: `RemoveAwardEmojiInput` - -#### Arguments - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="mutationremoveawardemojiawardableid"></a>`awardableId` | [`AwardableID!`](#awardableid) | The global ID of the awardable resource. | -| <a id="mutationremoveawardemojiclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | -| <a id="mutationremoveawardemojiname"></a>`name` | [`String!`](#string) | The emoji name. | - -#### Fields - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="mutationremoveawardemojiawardemoji"></a>`awardEmoji` | [`AwardEmoji`](#awardemoji) | The award emoji after mutation. | -| <a id="mutationremoveawardemojiclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | -| <a id="mutationremoveawardemojierrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | - ### `Mutation.removeProjectFromSecurityDashboard` Input type: `RemoveProjectFromSecurityDashboardInput` @@ -3577,55 +3479,6 @@ Input type: `RepositionImageDiffNoteInput` | <a id="mutationrepositionimagediffnoteerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | | <a id="mutationrepositionimagediffnotenote"></a>`note` | [`Note`](#note) | The note after mutation. | -### `Mutation.revertVulnerabilityToDetected` - -WARNING: -**Deprecated** in 13.5. -Use vulnerabilityRevertToDetected. - -Input type: `RevertVulnerabilityToDetectedInput` - -#### Arguments - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="mutationrevertvulnerabilitytodetectedclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | -| <a id="mutationrevertvulnerabilitytodetectedid"></a>`id` | [`VulnerabilityID!`](#vulnerabilityid) | ID of the vulnerability to be reverted. | - -#### Fields - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="mutationrevertvulnerabilitytodetectedclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | -| <a id="mutationrevertvulnerabilitytodetectederrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | -| <a id="mutationrevertvulnerabilitytodetectedvulnerability"></a>`vulnerability` | [`Vulnerability`](#vulnerability) | The vulnerability after revert. | - -### `Mutation.runDastScan` - -WARNING: -**Deprecated** in 13.4. -Use DastOnDemandScanCreate. - -Input type: `RunDASTScanInput` - -#### Arguments - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="mutationrundastscanbranch"></a>`branch` | [`String!`](#string) | The branch to be associated with the scan. | -| <a id="mutationrundastscanclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | -| <a id="mutationrundastscanprojectpath"></a>`projectPath` | [`ID!`](#id) | The project the DAST scan belongs to. | -| <a id="mutationrundastscanscantype"></a>`scanType` | [`DastScanTypeEnum!`](#dastscantypeenum) | The type of scan to be run. | -| <a id="mutationrundastscantargeturl"></a>`targetUrl` | [`String!`](#string) | The URL of the target to be scanned. | - -#### Fields - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="mutationrundastscanclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | -| <a id="mutationrundastscanerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | -| <a id="mutationrundastscanpipelineurl"></a>`pipelineUrl` | [`String`](#string) | URL of the pipeline that was created. | - ### `Mutation.runnerDelete` Available only when feature flag `runner_graphql_query` is enabled. @@ -3803,7 +3656,6 @@ Input type: `TodoRestoreManyInput` | <a id="mutationtodorestoremanyclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | | <a id="mutationtodorestoremanyerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | | <a id="mutationtodorestoremanytodos"></a>`todos` | [`[Todo!]!`](#todo) | Updated to-do items. | -| <a id="mutationtodorestoremanyupdatedids"></a>`updatedIds` **{warning-solid}** | [`[TodoID!]!`](#todoid) | **Deprecated:** Use to-do items. Deprecated in 13.2. | ### `Mutation.todosMarkAllDone` @@ -3822,32 +3674,6 @@ Input type: `TodosMarkAllDoneInput` | <a id="mutationtodosmarkalldoneclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | | <a id="mutationtodosmarkalldoneerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | | <a id="mutationtodosmarkalldonetodos"></a>`todos` | [`[Todo!]!`](#todo) | Updated to-do items. | -| <a id="mutationtodosmarkalldoneupdatedids"></a>`updatedIds` **{warning-solid}** | [`[TodoID!]!`](#todoid) | **Deprecated:** Use to-do items. Deprecated in 13.2. | - -### `Mutation.toggleAwardEmoji` - -WARNING: -**Deprecated** in 13.2. -Use awardEmojiToggle. - -Input type: `ToggleAwardEmojiInput` - -#### Arguments - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="mutationtoggleawardemojiawardableid"></a>`awardableId` | [`AwardableID!`](#awardableid) | The global ID of the awardable resource. | -| <a id="mutationtoggleawardemojiclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | -| <a id="mutationtoggleawardemojiname"></a>`name` | [`String!`](#string) | The emoji name. | - -#### Fields - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="mutationtoggleawardemojiawardemoji"></a>`awardEmoji` | [`AwardEmoji`](#awardemoji) | The award emoji after mutation. | -| <a id="mutationtoggleawardemojiclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | -| <a id="mutationtoggleawardemojierrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | -| <a id="mutationtoggleawardemojitoggledon"></a>`toggledOn` | [`Boolean!`](#boolean) | Indicates the status of the emoji. True if the toggle awarded the emoji, and false if the toggle removed the emoji. | ### `Mutation.updateAlertStatus` @@ -6875,29 +6701,6 @@ The edge type for [`UserCore`](#usercore). | <a id="usercoreedgecursor"></a>`cursor` | [`String!`](#string) | A cursor for use in pagination. | | <a id="usercoreedgenode"></a>`node` | [`UserCore`](#usercore) | The item at the end of the edge. | -#### `VulnerabilitiesCountByDayAndSeverityConnection` - -The connection type for [`VulnerabilitiesCountByDayAndSeverity`](#vulnerabilitiescountbydayandseverity). - -##### Fields - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="vulnerabilitiescountbydayandseverityconnectionedges"></a>`edges` | [`[VulnerabilitiesCountByDayAndSeverityEdge]`](#vulnerabilitiescountbydayandseverityedge) | A list of edges. | -| <a id="vulnerabilitiescountbydayandseverityconnectionnodes"></a>`nodes` | [`[VulnerabilitiesCountByDayAndSeverity]`](#vulnerabilitiescountbydayandseverity) | A list of nodes. | -| <a id="vulnerabilitiescountbydayandseverityconnectionpageinfo"></a>`pageInfo` | [`PageInfo!`](#pageinfo) | Information to aid in pagination. | - -#### `VulnerabilitiesCountByDayAndSeverityEdge` - -The edge type for [`VulnerabilitiesCountByDayAndSeverity`](#vulnerabilitiescountbydayandseverity). - -##### Fields - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="vulnerabilitiescountbydayandseverityedgecursor"></a>`cursor` | [`String!`](#string) | A cursor for use in pagination. | -| <a id="vulnerabilitiescountbydayandseverityedgenode"></a>`node` | [`VulnerabilitiesCountByDayAndSeverity`](#vulnerabilitiescountbydayandseverity) | The item at the end of the edge. | - #### `VulnerabilitiesCountByDayConnection` The connection type for [`VulnerabilitiesCountByDay`](#vulnerabilitiescountbyday). @@ -8043,7 +7846,6 @@ Represents a DAST scanner profile. | Name | Type | Description | | ---- | ---- | ----------- | | <a id="dastscannerprofileeditpath"></a>`editPath` | [`String`](#string) | Relative web path to the edit page of a scanner profile. | -| <a id="dastscannerprofileglobalid"></a>`globalId` **{warning-solid}** | [`DastScannerProfileID!`](#dastscannerprofileid) | **Deprecated** in 13.6. Use `id`. | | <a id="dastscannerprofileid"></a>`id` | [`DastScannerProfileID!`](#dastscannerprofileid) | ID of the DAST scanner profile. | | <a id="dastscannerprofileprofilename"></a>`profileName` | [`String`](#string) | Name of the DAST scanner profile. | | <a id="dastscannerprofilereferencedinsecuritypolicies"></a>`referencedInSecurityPolicies` | [`[String!]`](#string) | List of security policy names that are referencing given project. | @@ -9558,27 +9360,6 @@ four standard [pagination arguments](#connection-pagination-arguments): | <a id="groupvulnerabilitiescountbydayenddate"></a>`endDate` | [`ISO8601Date!`](#iso8601date) | Last day for which to fetch vulnerability history. | | <a id="groupvulnerabilitiescountbydaystartdate"></a>`startDate` | [`ISO8601Date!`](#iso8601date) | First day for which to fetch vulnerability history. | -##### `Group.vulnerabilitiesCountByDayAndSeverity` - -Number of vulnerabilities per severity level, per day, for the projects in the group and its subgroups. - -WARNING: -**Deprecated** in 13.3. -Use `vulnerabilitiesCountByDay`. - -Returns [`VulnerabilitiesCountByDayAndSeverityConnection`](#vulnerabilitiescountbydayandseverityconnection). - -This field returns a [connection](#connections). It accepts the -four standard [pagination arguments](#connection-pagination-arguments): -`before: String`, `after: String`, `first: Int`, `last: Int`. - -###### Arguments - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="groupvulnerabilitiescountbydayandseverityenddate"></a>`endDate` | [`ISO8601Date!`](#iso8601date) | Last day for which to fetch vulnerability history. | -| <a id="groupvulnerabilitiescountbydayandseveritystartdate"></a>`startDate` | [`ISO8601Date!`](#iso8601date) | First day for which to fetch vulnerability history. | - ##### `Group.vulnerabilityGrades` Represents vulnerable project counts for each grade. @@ -12417,18 +12198,6 @@ Counts of requirements by their state. | <a id="rootstoragestatisticsuploadssize"></a>`uploadsSize` | [`Float!`](#float) | The uploads size in bytes. | | <a id="rootstoragestatisticswikisize"></a>`wikiSize` | [`Float!`](#float) | The wiki size in bytes. | -### `RunDASTScanPayload` - -Autogenerated return type of RunDASTScan. - -#### Fields - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="rundastscanpayloadclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | -| <a id="rundastscanpayloaderrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | -| <a id="rundastscanpayloadpipelineurl"></a>`pipelineUrl` | [`String`](#string) | URL of the pipeline that was created. | - ### `RunnerArchitecture` #### Fields @@ -12771,7 +12540,6 @@ Represents a snippet entry. | Name | Type | Description | | ---- | ---- | ----------- | | <a id="snippetauthor"></a>`author` | [`UserCore`](#usercore) | The owner of the snippet. | -| <a id="snippetblob"></a>`blob` **{warning-solid}** | [`SnippetBlob!`](#snippetblob) | **Deprecated** in 13.3. Use `blobs`. | | <a id="snippetcreatedat"></a>`createdAt` | [`Time!`](#time) | Timestamp this snippet was created. | | <a id="snippetdescription"></a>`description` | [`String`](#string) | Description of the snippet. | | <a id="snippetdescriptionhtml"></a>`descriptionHtml` | [`String`](#string) | The GitLab Flavored Markdown rendering of `description`. | @@ -13389,18 +13157,6 @@ Represents the count of vulnerabilities by severity on a particular day. This da | <a id="vulnerabilitiescountbydaytotal"></a>`total` | [`Int!`](#int) | Total number of vulnerabilities on a particular day. | | <a id="vulnerabilitiescountbydayunknown"></a>`unknown` | [`Int!`](#int) | Total number of vulnerabilities on a particular day with unknown severity. | -### `VulnerabilitiesCountByDayAndSeverity` - -Represents the number of vulnerabilities for a particular severity on a particular day. This data is retained for 365 days. - -#### Fields - -| Name | Type | Description | -| ---- | ---- | ----------- | -| <a id="vulnerabilitiescountbydayandseveritycount"></a>`count` | [`Int`](#int) | Number of vulnerabilities. | -| <a id="vulnerabilitiescountbydayandseverityday"></a>`day` | [`ISO8601Date`](#iso8601date) | Date for the count. | -| <a id="vulnerabilitiescountbydayandseverityseverity"></a>`severity` | [`VulnerabilitySeverity`](#vulnerabilityseverity) | Severity of the counted vulnerabilities. | - ### `Vulnerability` Represents a vulnerability. diff --git a/doc/api/graphql/removed_items.md b/doc/api/graphql/removed_items.md index a76f1fb74184d1a94db1882bc043a192b2c75b5d..d8fc6cb35f8ef1c6edcf79b7504ac468996bee12 100644 --- a/doc/api/graphql/removed_items.md +++ b/doc/api/graphql/removed_items.md @@ -10,6 +10,32 @@ GraphQL is a versionless API, unlike the REST API. Occasionally, items have to be updated or removed from the GraphQL API. According to our [process for removing items](index.md#deprecation-and-removal-process), here are the items that have been removed. +## GitLab 14.0 + +Fields removed in [GitLab 14.0](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/63293): + +### GraphQL Mutations + +| Argument name | Mutation | Deprecated in | Use instead | +| -------------------- | -------------------- | ------------- | -------------------------- | +| `updated_ids` | `todosMarkAllDone` | 13.2 | `todos` | +| `updated_ids` | `todoRestoreMany` | 13.2 | `todos` | +| `global_id` | `dastScannerProfileCreate`| 13.6 | `todos` | +| - | `addAwardEmoji` | 13.2 | `awardEmojiAdd` | +| - | `removeAwardEmoji` | 13.2 | `awardEmojiRemove` | +| - | `toggleAwardEmoji` | 13.2 | `ToggleAwardEmoji` | +| - | `runDastScan` | 13.5 | `dastOnDemandScanCreate` | +| - | `dismissVulnerability` | 13.5 | `vulnerabilityDismiss` | +| - | `revertVulnerabilityToDetected` | 13.5 | `vulnerabilityRevertToDetected` | + +### GraphQL Types + +| Field name | GraphQL type | Deprecated in | Use instead | +| -------------------- | -------------------- | ------------- | -------------------------- | +| `blob` | `SnippetType` | 13.3 | `blobs` | +| `global_id` | `DastScannerProfileType` | 13.6 | `blobs` | +| `vulnerabilities_count_by_day_and_severity` | `GroupType`, `QueryType` | 13.3 | None. Plaintext tokens no longer supported for security reasons. | + ## GitLab 13.6 Fields removed in [GitLab 13.6](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/44866): diff --git a/ee/app/assets/javascripts/on_demand_scans/graphql/run_dast_scan.mutation.graphql b/ee/app/assets/javascripts/on_demand_scans/graphql/run_dast_scan.mutation.graphql deleted file mode 100644 index c37368313b5e6d900d807d60520000435e9f0047..0000000000000000000000000000000000000000 --- a/ee/app/assets/javascripts/on_demand_scans/graphql/run_dast_scan.mutation.graphql +++ /dev/null @@ -1,18 +0,0 @@ -mutation runDastScan( - $projectPath: ID! - $targetUrl: String! - $branch: String! - $scanType: DastScanTypeEnum! -) { - runDastScan( - input: { - projectPath: $projectPath - targetUrl: $targetUrl - branch: $branch - scanType: $scanType - } - ) { - pipelineUrl - errors - } -} diff --git a/ee/app/graphql/ee/types/deprecated_mutations.rb b/ee/app/graphql/ee/types/deprecated_mutations.rb index e521940272d20bbaf26574641683cacb4b22ed05..cee58cea427606920f2b61112497e42d16be882a 100644 --- a/ee/app/graphql/ee/types/deprecated_mutations.rb +++ b/ee/app/graphql/ee/types/deprecated_mutations.rb @@ -6,15 +6,6 @@ module DeprecatedMutations extend ActiveSupport::Concern prepended do - mount_mutation ::Mutations::Pipelines::RunDastScan, - deprecated: { reason: 'Use DastOnDemandScanCreate', milestone: '13.4' } - - mount_aliased_mutation 'DismissVulnerability', ::Mutations::Vulnerabilities::Dismiss, - deprecated: { reason: 'Use vulnerabilityDismiss', milestone: '13.5' } - - mount_aliased_mutation 'RevertVulnerabilityToDetected', ::Mutations::Vulnerabilities::RevertToDetected, - deprecated: { reason: 'Use vulnerabilityRevertToDetected', milestone: '13.5' } - mount_aliased_mutation 'CreateIteration', ::Mutations::Iterations::Create, deprecated: { reason: 'Use iterationCreate', milestone: '14.0' } end diff --git a/ee/app/graphql/ee/types/group_type.rb b/ee/app/graphql/ee/types/group_type.rb index 77343cf5a873ab40a49a54a02792ea599c69659c..7c497434442b63f4fed6164bcba25297d7af5b9c 100644 --- a/ee/app/graphql/ee/types/group_type.rb +++ b/ee/app/graphql/ee/types/group_type.rb @@ -65,13 +65,6 @@ module GroupType description: 'Number of vulnerabilities per day for the projects in the group and its subgroups.', resolver: ::Resolvers::VulnerabilitiesCountPerDayResolver - field :vulnerabilities_count_by_day_and_severity, - ::Types::VulnerabilitiesCountByDayAndSeverityType.connection_type, - null: true, - description: 'Number of vulnerabilities per severity level, per day, for the projects in the group and its subgroups.', - resolver: ::Resolvers::VulnerabilitiesHistoryResolver, - deprecated: { reason: 'Use `vulnerabilitiesCountByDay`', milestone: '13.3' } - field :vulnerability_grades, [::Types::VulnerableProjectsByGradeType], null: false, diff --git a/ee/app/graphql/ee/types/query_type.rb b/ee/app/graphql/ee/types/query_type.rb index da4603a89718d989ee46c3137ba46b42aabc6374..1b1c9a4b743126125956ca59d85e6524688bff73 100644 --- a/ee/app/graphql/ee/types/query_type.rb +++ b/ee/app/graphql/ee/types/query_type.rb @@ -37,16 +37,6 @@ module QueryType Number of vulnerabilities per day for the projects on the current user's instance security dashboard. DESC - field :vulnerabilities_count_by_day_and_severity, - ::Types::VulnerabilitiesCountByDayAndSeverityType.connection_type, - null: true, - resolver: ::Resolvers::VulnerabilitiesHistoryResolver, - deprecated: { reason: :discouraged, replacement: 'Query.vulnerabilitiesCountByDay', milestone: '13.3' }, - description: <<~DESC - Number of vulnerabilities per severity level, per day, for the projects on the - current user's instance security dashboard. - DESC - field :geo_node, ::Types::Geo::GeoNodeType, null: true, resolver: ::Resolvers::Geo::GeoNodeResolver, diff --git a/ee/app/graphql/mutations/dast_scanner_profiles/create.rb b/ee/app/graphql/mutations/dast_scanner_profiles/create.rb index 40413e49edba3c2571ecd91706eeb60acb0a24c9..73f00eace08f8e69bfba147f5934aad725231945 100644 --- a/ee/app/graphql/mutations/dast_scanner_profiles/create.rb +++ b/ee/app/graphql/mutations/dast_scanner_profiles/create.rb @@ -11,11 +11,6 @@ class Create < BaseMutation null: true, description: 'ID of the scanner profile.' - field :global_id, ::Types::GlobalIDType[::DastScannerProfile], - null: true, - description: 'ID of the scanner profile.', - deprecated: { reason: 'Use `id`', milestone: '13.6' } - argument :full_path, GraphQL::ID_TYPE, required: true, description: 'The project the scanner profile belongs to.' diff --git a/ee/app/graphql/mutations/pipelines/run_dast_scan.rb b/ee/app/graphql/mutations/pipelines/run_dast_scan.rb deleted file mode 100644 index aba584aa2a00af85f5a81857cc0b99bb88d455b2..0000000000000000000000000000000000000000 --- a/ee/app/graphql/mutations/pipelines/run_dast_scan.rb +++ /dev/null @@ -1,69 +0,0 @@ -# frozen_string_literal: true - -module Mutations - module Pipelines - class RunDastScan < BaseMutation - include FindsProject - - graphql_name 'RunDASTScan' - - field :pipeline_url, GraphQL::STRING_TYPE, - null: true, - description: 'URL of the pipeline that was created.' - - argument :project_path, GraphQL::ID_TYPE, - required: true, - description: 'The project the DAST scan belongs to.' - - argument :target_url, GraphQL::STRING_TYPE, - required: true, - description: 'The URL of the target to be scanned.' - - argument :branch, GraphQL::STRING_TYPE, - required: true, - description: 'The branch to be associated with the scan.' - - argument :scan_type, Types::DastScanTypeEnum, - required: true, - description: 'The type of scan to be run.' - - authorize :create_on_demand_dast_scan - - def resolve(project_path:, target_url:, branch:, scan_type:) - project = authorized_find!(project_path) - - result = ::DastOnDemandScans::CreateService.new( - container: project, - current_user: current_user, - params: { - branch: branch, - dast_site_profile: DastSiteProfile.new(dast_site: DastSite.new(url: target_url)) - } - ).execute - - if result.success? - success_response(project: project, pipeline: result.payload[:pipeline]) - else - error_response(result.message) - end - end - - private - - def success_response(project:, pipeline:) - pipeline_url = Rails.application.routes.url_helpers.project_pipeline_url( - project, - pipeline - ) - { - errors: [], - pipeline_url: pipeline_url - } - end - - def error_response(message) - { errors: [message] } - end - end - end -end diff --git a/ee/app/graphql/resolvers/vulnerabilities_history_resolver.rb b/ee/app/graphql/resolvers/vulnerabilities_history_resolver.rb deleted file mode 100644 index 7a5e044e77360cc5037f9d62e6ce470f207ec165..0000000000000000000000000000000000000000 --- a/ee/app/graphql/resolvers/vulnerabilities_history_resolver.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -module Resolvers - class VulnerabilitiesHistoryResolver < VulnerabilitiesBaseResolver - include Gitlab::Utils::StrongMemoize - - MAX_DAYS = ::Vulnerability::MAX_DAYS_OF_HISTORY - - type Types::VulnerabilitiesCountByDayAndSeverityType, null: true - - argument :start_date, GraphQL::Types::ISO8601Date, required: true, - description: 'First day for which to fetch vulnerability history.' - - argument :end_date, GraphQL::Types::ISO8601Date, required: true, - description: 'Last day for which to fetch vulnerability history.' - - def resolve(**args) - return [] unless vulnerable - - start_date = args[:start_date] - end_date = args[:end_date] - days = end_date - start_date + 1 - - if days > MAX_DAYS - raise ::Vulnerability::TooManyDaysError, "Cannot fetch counts for more than #{MAX_DAYS} days" - else - vulnerable.vulnerabilities.counts_by_day_and_severity(start_date, end_date).to_a - end - end - end -end diff --git a/ee/app/graphql/types/dast_scanner_profile_type.rb b/ee/app/graphql/types/dast_scanner_profile_type.rb index a20e418a5900bdc4b5affbd50a00e62c6659f979..dff1bb1ae8de32f88125513239d92f3782f3bfa7 100644 --- a/ee/app/graphql/types/dast_scanner_profile_type.rb +++ b/ee/app/graphql/types/dast_scanner_profile_type.rb @@ -10,11 +10,6 @@ class DastScannerProfileType < BaseObject field :id, ::Types::GlobalIDType[::DastScannerProfile], null: false, description: 'ID of the DAST scanner profile.' - field :global_id, ::Types::GlobalIDType[::DastScannerProfile], null: false, - description: 'ID of the DAST scanner profile.', - deprecated: { reason: 'Use `id`', milestone: '13.6' }, - method: :id - field :profile_name, GraphQL::STRING_TYPE, null: true, description: 'Name of the DAST scanner profile.', method: :name diff --git a/ee/app/graphql/types/vulnerabilities_count_by_day_and_severity_type.rb b/ee/app/graphql/types/vulnerabilities_count_by_day_and_severity_type.rb deleted file mode 100644 index 3a182004c63b7306f4e66055155e9880d21a8d67..0000000000000000000000000000000000000000 --- a/ee/app/graphql/types/vulnerabilities_count_by_day_and_severity_type.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Types - # rubocop: disable Graphql/AuthorizeTypes - class VulnerabilitiesCountByDayAndSeverityType < BaseObject - graphql_name 'VulnerabilitiesCountByDayAndSeverity' - description 'Represents the number of vulnerabilities for a particular severity on a particular day. This data is retained for 365 days' - - field :count, GraphQL::INT_TYPE, null: true, - description: 'Number of vulnerabilities.' - - field :day, GraphQL::Types::ISO8601Date, null: true, - description: 'Date for the count.' - - field :severity, VulnerabilitySeverityEnum, null: true, - description: 'Severity of the counted vulnerabilities.' - end -end diff --git a/ee/spec/graphql/ee/types/group_type_spec.rb b/ee/spec/graphql/ee/types/group_type_spec.rb index c1942d0572b50dcae67981129afc0c461ec4154f..58e393daea9e53bc8578e702e2922704810f036b 100644 --- a/ee/spec/graphql/ee/types/group_type_spec.rb +++ b/ee/spec/graphql/ee/types/group_type_spec.rb @@ -16,7 +16,7 @@ it { expect(described_class).to have_graphql_field(:timelogs, complexity: 5) } it { expect(described_class).to have_graphql_field(:vulnerabilities) } it { expect(described_class).to have_graphql_field(:vulnerability_scanners) } - it { expect(described_class).to have_graphql_field(:vulnerabilities_count_by_day_and_severity) } + it { expect(described_class).to have_graphql_field(:vulnerabilities_count_by_day) } it { expect(described_class).to have_graphql_field(:vulnerability_grades) } it { expect(described_class).to have_graphql_field(:code_coverage_activities) } it { expect(described_class).to have_graphql_field(:stats) } diff --git a/ee/spec/graphql/mutations/pipelines/run_dast_scan_spec.rb b/ee/spec/graphql/mutations/pipelines/run_dast_scan_spec.rb deleted file mode 100644 index 7430bedf9b5e22f16d9cfb7268514da2bb4f540b..0000000000000000000000000000000000000000 --- a/ee/spec/graphql/mutations/pipelines/run_dast_scan_spec.rb +++ /dev/null @@ -1,90 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Mutations::Pipelines::RunDastScan do - let(:group) { create(:group) } - let(:project) { create(:project, :repository, group: group) } - let(:user) { create(:user) } - let(:project_path) { project.full_path } - let(:target_url) { generate(:url) } - let(:branch) { project.default_branch } - let(:scan_type) { Types::DastScanTypeEnum.enum[:passive] } - - subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) } - - before do - stub_licensed_features(security_on_demand_scans: true) - end - - describe '#resolve' do - subject do - mutation.resolve( - branch: branch, - project_path: project_path, - target_url: target_url, - scan_type: scan_type - ) - end - - context 'when on demand scan feature is not enabled' do - it 'raises an exception' do - expect { subject }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable) - end - end - - context 'when on demand scan feature is enabled' do - context 'when the project does not exist' do - let(:project_path) { SecureRandom.hex } - - it 'raises an exception' do - expect { subject }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable) - end - end - - context 'when the user is not associated with the project' do - it 'raises an exception' do - expect { subject }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable) - end - end - - context 'when the user is an owner' do - it 'has no errors' do - group.add_owner(user) - - expect(subject[:errors]).to be_empty - end - end - - context 'when the user is a maintainer' do - it 'has no errors' do - project.add_maintainer(user) - - expect(subject[:errors]).to be_empty - end - end - - context 'when the user is a developer' do - it 'has no errors' do - project.add_developer(user) - - expect(subject[:errors]).to be_empty - end - end - - context 'when the user can run a dast scan' do - it 'returns a pipeline_url containing the correct path' do - project.add_developer(user) - - actual_url = subject[:pipeline_url] - pipeline = Ci::Pipeline.last - expected_url = Rails.application.routes.url_helpers.project_pipeline_url( - project, - pipeline - ) - expect(actual_url).to eq(expected_url) - end - end - end - end -end diff --git a/ee/spec/graphql/resolvers/vulnerabilities_history_resolver_spec.rb b/ee/spec/graphql/resolvers/vulnerabilities_history_resolver_spec.rb deleted file mode 100644 index a2062d911ca94ebc1bed5f5c6d83c16c1c1fd1c4..0000000000000000000000000000000000000000 --- a/ee/spec/graphql/resolvers/vulnerabilities_history_resolver_spec.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Resolvers::VulnerabilitiesHistoryResolver do - include GraphqlHelpers - - subject { resolve(described_class, obj: group, args: args, ctx: { current_user: user }) } - - let_it_be(:group) { create(:group) } - let_it_be(:project) { create(:project, namespace: group) } - let_it_be(:user) { create(:user) } - - describe '#resolve' do - let(:args) { { start_date: Date.parse('2019-10-15'), end_date: Date.parse('2019-10-21') } } - - it "fetches historical vulnerability data from the start date to the end date" do - travel_to(Date.parse('2019-10-31')) do - create(:vulnerability, :critical, created_at: 15.days.ago, dismissed_at: 10.days.ago, project: project) - create(:vulnerability, :high, created_at: 15.days.ago, dismissed_at: 11.days.ago, project: project) - create(:vulnerability, :critical, created_at: 14.days.ago, resolved_at: 12.days.ago, project: project) - - ordered_history = subject.sort_by { |count| [count['day'], count['severity']] } - - expect(ordered_history.to_json).to eq([ - { 'day' => '2019-10-16', 'severity' => 'critical', 'count' => 1, 'id' => nil }, - { 'day' => '2019-10-16', 'severity' => 'high', 'count' => 1, 'id' => nil }, - { 'day' => '2019-10-17', 'severity' => 'critical', 'count' => 2, 'id' => nil }, - { 'day' => '2019-10-17', 'severity' => 'high', 'count' => 1, 'id' => nil }, - { 'day' => '2019-10-18', 'severity' => 'critical', 'count' => 2, 'id' => nil }, - { 'day' => '2019-10-18', 'severity' => 'high', 'count' => 1, 'id' => nil }, - { 'day' => '2019-10-19', 'severity' => 'critical', 'count' => 1, 'id' => nil }, - { 'day' => '2019-10-19', 'severity' => 'high', 'count' => 1, 'id' => nil }, - { 'day' => '2019-10-20', 'severity' => 'critical', 'count' => 1, 'id' => nil } - ].to_json) - end - end - - context 'when given more than 10 days' do - let(:args) { { start_date: Date.parse('2019-10-11'), end_date: Date.parse('2019-10-21') } } - - it 'raises an error stating that no more than 10 days can be requested' do - expect { subject }.to raise_error(::Vulnerability::TooManyDaysError, 'Cannot fetch counts for more than 10 days') - end - end - end -end diff --git a/ee/spec/graphql/types/dast_scanner_profile_type_spec.rb b/ee/spec/graphql/types/dast_scanner_profile_type_spec.rb index 54b1ea85cdfcb54a5f350b72438ee0e6acf2288c..7ff9574c61e4748f8adaf92f199b66508f2ee334 100644 --- a/ee/spec/graphql/types/dast_scanner_profile_type_spec.rb +++ b/ee/spec/graphql/types/dast_scanner_profile_type_spec.rb @@ -8,7 +8,7 @@ let_it_be(:dast_scanner_profile) { create(:dast_scanner_profile) } let_it_be(:project) { dast_scanner_profile.project } let_it_be(:user) { create(:user) } - let_it_be(:fields) { %i[id globalId profileName spiderTimeout targetTimeout editPath scanType useAjaxSpider showDebugMessages referencedInSecurityPolicies] } + let_it_be(:fields) { %i[id profileName spiderTimeout targetTimeout editPath scanType useAjaxSpider showDebugMessages referencedInSecurityPolicies] } let(:response) do GitlabSchema.execute( @@ -45,7 +45,6 @@ dastScannerProfiles { nodes { id - globalId profileName targetTimeout spiderTimeout diff --git a/ee/spec/graphql/types/mutation_type_spec.rb b/ee/spec/graphql/types/mutation_type_spec.rb deleted file mode 100644 index 630b8df55c2bc18824647e932c8cbeeb3a5a54f4..0000000000000000000000000000000000000000 --- a/ee/spec/graphql/types/mutation_type_spec.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe GitlabSchema.types['Mutation'] do - describe 'deprecated mutations' do - using RSpec::Parameterized::TableSyntax - - where(:field_name, :reason, :milestone) do - 'RunDastScan' | 'Use DastOnDemandScanCreate' | '13.4' - end - - with_them do - let(:field) { get_field(field_name) } - let(:deprecation_reason) { "#{reason}. Deprecated in #{milestone}." } - - it { expect(field).to be_present } - it { expect(field.deprecation_reason).to eq(deprecation_reason) } - end - end - - describe 'aliased deprecated mutations' do - using RSpec::Parameterized::TableSyntax - - where(:alias_name, :canonical_name) do - 'DismissVulnerability' | 'VulnerabilityDismiss' - 'RevertVulnerabilityToDetected' | 'VulnerabilityRevertToDetected' - end - - with_them do - let(:alias_field) { get_field(alias_name) } - let(:canonical_field) { get_field(canonical_name) } - - it { expect(alias_field).to be_present } - it { expect(canonical_field).to be_present } - it { expect(alias_field.deprecation_reason).to be_present } - it { expect(canonical_field.deprecation_reason).not_to be_present } - it { expect(alias_field.resolver.fields).to eq(canonical_field.resolver.fields) } - it { expect(alias_field.resolver.arguments).to eq(canonical_field.resolver.arguments) } - end - end - - def get_field(name) - described_class.fields[GraphqlHelpers.fieldnamerize(name.camelize)] - end -end diff --git a/ee/spec/graphql/types/query_type_spec.rb b/ee/spec/graphql/types/query_type_spec.rb index 767a5e9e01b9a71e61cfff98b78662415d521219..8a8716cb8995a4d3ccc8c95e5fd66534cbb3f5f0 100644 --- a/ee/spec/graphql/types/query_type_spec.rb +++ b/ee/spec/graphql/types/query_type_spec.rb @@ -10,7 +10,7 @@ :vulnerabilities, :vulnerability, :instance_security_dashboard, - :vulnerabilities_count_by_day_and_severity, + :vulnerabilities_count_by_day, :current_license, :license_history_entries ).at_least diff --git a/ee/spec/graphql/types/vulnerabilities_count_by_day_and_severity_type_spec.rb b/ee/spec/graphql/types/vulnerabilities_count_by_day_and_severity_type_spec.rb deleted file mode 100644 index 7701df07c1144531021fce530af656cac38f6cad..0000000000000000000000000000000000000000 --- a/ee/spec/graphql/types/vulnerabilities_count_by_day_and_severity_type_spec.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe GitlabSchema.types['VulnerabilitiesCountByDayAndSeverity'] do - it { expect(described_class).to have_graphql_fields(:count, :day, :severity) } -end diff --git a/ee/spec/requests/api/graphql/group/vulnerability_severities_count_by_day_spec.rb b/ee/spec/requests/api/graphql/group/vulnerability_severities_count_by_day_spec.rb deleted file mode 100644 index 61dbf3d26dc96e282fbcc5644a4238328ee3a7a7..0000000000000000000000000000000000000000 --- a/ee/spec/requests/api/graphql/group/vulnerability_severities_count_by_day_spec.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'group(fullPath).vulnerabilitiesCountByDayAndSeverity' do - include GraphqlHelpers - - let_it_be(:group) { create(:group) } - let_it_be(:project) { create(:project, namespace: group) } - let_it_be(:current_user) { create(:user) } - - let(:query) { graphql_query_for(:group, { fullPath: group.full_path }, history_field) } - let(:query_result) { graphql_data.dig('group', 'vulnerabilitiesCountByDayAndSeverity', 'nodes') } - - let(:history_field) do - query_graphql_field( - :vulnerabilitiesCountByDayAndSeverity, - { - start_date: Date.parse('2019-10-15').iso8601, - end_date: Date.parse('2019-10-21').iso8601 - }, - history_fields - ) - end - - let(:history_fields) do - query_graphql_field(:nodes, nil, <<~FIELDS) - count - day - severity - FIELDS - end - - it "fetches historical vulnerability data from the start date to the end date for projects in the group and its subgroups" do - travel_to(Time.zone.parse('2019-10-31')) do - project.add_developer(current_user) - - create(:vulnerability, :critical, created_at: 15.days.ago, dismissed_at: 10.days.ago, project: project) - create(:vulnerability, :high, created_at: 15.days.ago, dismissed_at: 11.days.ago, project: project) - create(:vulnerability, :critical, created_at: 14.days.ago, resolved_at: 12.days.ago, project: project) - - post_graphql(query, current_user: current_user) - - ordered_history = query_result.sort_by { |count| [count['day'], count['severity']] } - - expect(ordered_history).to eq([ - { 'severity' => 'CRITICAL', 'day' => '2019-10-16', 'count' => 1 }, - { 'severity' => 'HIGH', 'day' => '2019-10-16', 'count' => 1 }, - { 'severity' => 'CRITICAL', 'day' => '2019-10-17', 'count' => 2 }, - { 'severity' => 'HIGH', 'day' => '2019-10-17', 'count' => 1 }, - { 'severity' => 'CRITICAL', 'day' => '2019-10-18', 'count' => 2 }, - { 'severity' => 'HIGH', 'day' => '2019-10-18', 'count' => 1 }, - { 'severity' => 'CRITICAL', 'day' => '2019-10-19', 'count' => 1 }, - { 'severity' => 'HIGH', 'day' => '2019-10-19', 'count' => 1 }, - { 'severity' => 'CRITICAL', 'day' => '2019-10-20', 'count' => 1 } - ]) - end - end -end diff --git a/ee/spec/requests/api/graphql/mutations/dast_scanner_profiles/create_spec.rb b/ee/spec/requests/api/graphql/mutations/dast_scanner_profiles/create_spec.rb index d90c49e9abf92d2c5d14de86d0d489c89bac3b5d..f98a607476eb4123590323dd830087dbd1932cb2 100644 --- a/ee/spec/requests/api/graphql/mutations/dast_scanner_profiles/create_spec.rb +++ b/ee/spec/requests/api/graphql/mutations/dast_scanner_profiles/create_spec.rb @@ -25,12 +25,6 @@ expect(mutation_response['id']).to eq(dast_scanner_profile.to_global_id.to_s) end - it 'returns the dast_scanner_profile global_id' do - post_graphql_mutation(mutation, current_user: current_user) - - expect(mutation_response['globalId']).to eq(dast_scanner_profile.to_global_id.to_s) - end - it 'sets default values of omitted properties' do post_graphql_mutation(mutation, current_user: current_user) diff --git a/ee/spec/requests/api/graphql/mutations/pipelines/run_dast_scan_spec.rb b/ee/spec/requests/api/graphql/mutations/pipelines/run_dast_scan_spec.rb deleted file mode 100644 index 53396953d2f0d714f88684e6aa87cea2ec906675..0000000000000000000000000000000000000000 --- a/ee/spec/requests/api/graphql/mutations/pipelines/run_dast_scan_spec.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Running a DAST Scan' do - include GraphqlHelpers - - let(:project) { create(:project, :repository, creator: current_user) } - let(:current_user) { create(:user) } - let(:project_path) { project.full_path } - let(:target_url) { generate(:url) } - let(:branch) { project.default_branch } - let(:scan_type) { Types::DastScanTypeEnum.enum[:passive].upcase } - - let(:mutation) do - graphql_mutation( - :run_dast_scan, - branch: branch, - project_path: project_path, - target_url: target_url, - scan_type: scan_type - ) - end - - def mutation_response - graphql_mutation_response(:run_dast_scan) - end - - before do - stub_licensed_features(security_on_demand_scans: true) - end - - context 'when on demand scan feature is not enabled' do - it_behaves_like 'a mutation that returns top-level errors', - errors: ['The resource that you are attempting to access does not ' \ - 'exist or you don\'t have permission to perform this action'] - end - - context 'when on demand scan feature is enabled' do - context 'when the user does not have permission to run a dast scan' do - it_behaves_like 'a mutation that returns top-level errors', - errors: ['The resource that you are attempting to access does not ' \ - 'exist or you don\'t have permission to perform this action'] - end - - context 'when the user can run a dast scan' do - before do - project.add_developer(current_user) - end - - it 'returns a pipeline_url containing the correct path' do - post_graphql_mutation(mutation, current_user: current_user) - pipeline = Ci::Pipeline.last - expected_url = Rails.application.routes.url_helpers.project_pipeline_url( - project, - pipeline - ) - expect(mutation_response['pipelineUrl']).to eq(expected_url) - end - - context 'when pipeline creation fails' do - before do - allow_any_instance_of(Ci::Pipeline).to receive(:created_successfully?).and_return(false) - allow_any_instance_of(Ci::Pipeline).to receive(:full_error_messages).and_return('error message') - end - - it_behaves_like 'a mutation that returns errors in the response', errors: ['error message'] - end - end - end -end diff --git a/ee/spec/requests/api/graphql/project/dast_scanner_profiles_spec.rb b/ee/spec/requests/api/graphql/project/dast_scanner_profiles_spec.rb index d475d727cbbe57eea47351d3da51bd5b2b44955c..2307c480d5bf80ef52153d8e4253df9bbab245bf 100644 --- a/ee/spec/requests/api/graphql/project/dast_scanner_profiles_spec.rb +++ b/ee/spec/requests/api/graphql/project/dast_scanner_profiles_spec.rb @@ -87,11 +87,5 @@ it { is_expected.to eq(dast_scanner_profile.to_global_id.to_s) } end - - describe 'first dast scanner profile globalId' do - subject { response_data.dig('project', 'dastScannerProfiles', 'nodes').first['globalId'] } - - it { is_expected.to eq(dast_scanner_profile.to_global_id.to_s) } - end end end diff --git a/ee/spec/requests/api/graphql/query_spec.rb b/ee/spec/requests/api/graphql/query_spec.rb deleted file mode 100644 index 041d73d089cb7d8fba8ded7e114af809980d71e0..0000000000000000000000000000000000000000 --- a/ee/spec/requests/api/graphql/query_spec.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Query' do - include GraphqlHelpers - - describe '.vulnerabilitiesCountByDayAndSeverity' do - let(:query_result) { graphql_data.dig('vulnerabilitiesCountByDayAndSeverity', 'nodes') } - - let(:query) do - graphql_query_for( - :vulnerabilitiesCountByDayAndSeverity, - { - start_date: Date.parse('2019-10-15').iso8601, - end_date: Date.parse('2019-10-21').iso8601 - }, - history_fields - ) - end - - let(:history_fields) do - query_graphql_field(:nodes, nil, <<~FIELDS) - count - day - severity - FIELDS - end - - it "fetches historical vulnerability data from the start date to the end date for projects on the current user's instance security dashboard" do - travel_to(Time.zone.parse('2019-10-31')) do - project = create(:project) - current_user = create(:user) - current_user.security_dashboard_projects << project - project.add_developer(current_user) - - create(:vulnerability, :critical, created_at: 15.days.ago, dismissed_at: 10.days.ago, project: project) - create(:vulnerability, :high, created_at: 15.days.ago, dismissed_at: 11.days.ago, project: project) - create(:vulnerability, :critical, created_at: 14.days.ago, resolved_at: 12.days.ago, project: project) - - post_graphql(query, current_user: current_user) - - ordered_history = query_result.sort_by { |count| [count['day'], count['severity']] } - - expect(ordered_history).to eq([ - { 'severity' => 'CRITICAL', 'day' => '2019-10-16', 'count' => 1 }, - { 'severity' => 'HIGH', 'day' => '2019-10-16', 'count' => 1 }, - { 'severity' => 'CRITICAL', 'day' => '2019-10-17', 'count' => 2 }, - { 'severity' => 'HIGH', 'day' => '2019-10-17', 'count' => 1 }, - { 'severity' => 'CRITICAL', 'day' => '2019-10-18', 'count' => 2 }, - { 'severity' => 'HIGH', 'day' => '2019-10-18', 'count' => 1 }, - { 'severity' => 'CRITICAL', 'day' => '2019-10-19', 'count' => 1 }, - { 'severity' => 'HIGH', 'day' => '2019-10-19', 'count' => 1 }, - { 'severity' => 'CRITICAL', 'day' => '2019-10-20', 'count' => 1 } - ]) - end - end - end -end diff --git a/spec/graphql/mutations/todos/mark_all_done_spec.rb b/spec/graphql/mutations/todos/mark_all_done_spec.rb index f3b6bf52ef79dcd5ef28061c13d58ae033277571..1e12d86aa185e23c2da9e212d7efe33bf9b0aea3 100644 --- a/spec/graphql/mutations/todos/mark_all_done_spec.rb +++ b/spec/graphql/mutations/todos/mark_all_done_spec.rb @@ -21,26 +21,25 @@ describe '#resolve' do it 'marks all pending todos as done' do - updated_todo_ids, todos = mutation_for(current_user).resolve.values_at(:updated_ids, :todos) + todos = mutation_for(current_user).resolve[:todos] expect(todo1.reload.state).to eq('done') expect(todo2.reload.state).to eq('done') expect(todo3.reload.state).to eq('done') expect(other_user_todo.reload.state).to eq('pending') - expect(updated_todo_ids).to contain_exactly(todo1.id, todo3.id) expect(todos).to contain_exactly(todo1, todo3) end it 'behaves as expected if there are no todos for the requesting user' do - updated_todo_ids = mutation_for(user3).resolve.dig(:updated_ids) + todos = mutation_for(user3).resolve[:todos] expect(todo1.reload.state).to eq('pending') expect(todo2.reload.state).to eq('done') expect(todo3.reload.state).to eq('pending') expect(other_user_todo.reload.state).to eq('pending') - expect(updated_todo_ids).to be_empty + expect(todos).to be_empty end context 'when user is not logged in' do diff --git a/spec/graphql/types/mutation_type_spec.rb b/spec/graphql/types/mutation_type_spec.rb index e4144e4fa97902abcf62131ef7a89132a35f10e1..c1a5c93c85b95f1e33a39dfff6bac32027253e0b 100644 --- a/spec/graphql/types/mutation_type_spec.rb +++ b/spec/graphql/types/mutation_type_spec.rb @@ -15,28 +15,6 @@ expect(described_class).to have_graphql_mutation(Mutations::MergeRequests::SetDraft) end - describe 'deprecated and aliased mutations' do - using RSpec::Parameterized::TableSyntax - - where(:alias_name, :canonical_name) do - 'AddAwardEmoji' | 'AwardEmojiAdd' - 'RemoveAwardEmoji' | 'AwardEmojiRemove' - 'ToggleAwardEmoji' | 'AwardEmojiToggle' - end - - with_them do - let(:alias_field) { get_field(alias_name) } - let(:canonical_field) { get_field(canonical_name) } - - it { expect(alias_field).to be_present } - it { expect(canonical_field).to be_present } - it { expect(alias_field.deprecation_reason).to be_present } - it { expect(canonical_field.deprecation_reason).not_to be_present } - it { expect(alias_field.resolver.fields).to eq(canonical_field.resolver.fields) } - it { expect(alias_field.resolver.arguments).to eq(canonical_field.resolver.arguments) } - end - end - def get_field(name) described_class.fields[GraphqlHelpers.fieldnamerize(name)] end diff --git a/spec/graphql/types/snippet_type_spec.rb b/spec/graphql/types/snippet_type_spec.rb index b87770ebe8d98a85698a36c6856ba0d2ef5fdad9..f284d88180c3cc3a4e8066f881aae35445217bc8 100644 --- a/spec/graphql/types/snippet_type_spec.rb +++ b/spec/graphql/types/snippet_type_spec.rb @@ -13,7 +13,7 @@ :visibility_level, :created_at, :updated_at, :web_url, :raw_url, :ssh_url_to_repo, :http_url_to_repo, :notes, :discussions, :user_permissions, - :description_html, :blob, :blobs] + :description_html, :blobs] expect(described_class).to have_graphql_fields(*expected_fields) end @@ -133,32 +133,6 @@ end end - describe '#blob' do - let(:query_blob) { subject.dig('data', 'snippets', 'nodes')[0]['blob'] } - - subject { GitlabSchema.execute(snippet_query_for(field: 'blob'), context: { current_user: user }).as_json } - - context 'when snippet has repository' do - let!(:snippet) { create(:personal_snippet, :repository, :public, author: user) } - let(:blob) { snippet.blobs.first } - - it 'returns the first blob from the repository' do - expect(query_blob['name']).to eq blob.name - expect(query_blob['path']).to eq blob.path - end - end - - context 'when snippet does not have a repository' do - let!(:snippet) { create(:personal_snippet, :public, author: user) } - let(:blob) { snippet.blob } - - it 'returns SnippetBlob type' do - expect(query_blob['name']).to eq blob.name - expect(query_blob['path']).to eq blob.path - end - end - end - describe '#blobs' do let_it_be(:snippet) { create(:personal_snippet, :public, author: user) } diff --git a/spec/graphql/types/snippets/blob_viewer_type_spec.rb b/spec/graphql/types/snippets/blob_viewer_type_spec.rb index 295df992c67723965edc1fe89abf1cec17f57c1e..c3b98236f2b4c04353accb4e50f4f90abbe0ece5 100644 --- a/spec/graphql/types/snippets/blob_viewer_type_spec.rb +++ b/spec/graphql/types/snippets/blob_viewer_type_spec.rb @@ -31,7 +31,7 @@ end it 'returns false' do - snippet_blob = subject.dig('data', 'snippets', 'edges')[0].dig('node', 'blob') + snippet_blob = subject.dig('data', 'snippets', 'edges').first.dig('node', 'blobs', 'nodes').find { |b| b['path'] == blob.path } expect(snippet_blob['path']).to eq blob.path expect(blob_attribute).to be_nil @@ -47,10 +47,12 @@ snippets(ids: "#{snippet.to_global_id}") { edges { node { - blob { - path - simpleViewer { - collapsed + blobs { + nodes { + path + simpleViewer { + collapsed + } } } } @@ -73,10 +75,12 @@ snippets(ids: "#{snippet.to_global_id}") { edges { node { - blob { - path - simpleViewer { - tooLarge + blobs { + nodes { + path + simpleViewer { + tooLarge + } } } } diff --git a/spec/requests/api/graphql/mutations/todos/mark_all_done_spec.rb b/spec/requests/api/graphql/mutations/todos/mark_all_done_spec.rb index 705ef28ffd4d427e2680cb4140f6e205165f5c62..8f92105dc9cf91277dd8b68ed799198168e29f47 100644 --- a/spec/requests/api/graphql/mutations/todos/mark_all_done_spec.rb +++ b/spec/requests/api/graphql/mutations/todos/mark_all_done_spec.rb @@ -22,8 +22,8 @@ graphql_mutation(:todos_mark_all_done, input, <<-QL.strip_heredoc clientMutationId + todos { id } errors - updatedIds QL ) end @@ -40,7 +40,7 @@ def mutation_response expect(todo3.reload.state).to eq('done') expect(other_user_todo.reload.state).to eq('pending') - updated_todo_ids = mutation_response['updatedIds'] + updated_todo_ids = mutation_response['todos'].map { |todo| todo['id'] } expect(updated_todo_ids).to contain_exactly(global_id_of(todo1), global_id_of(todo3)) end @@ -52,7 +52,7 @@ def mutation_response expect(todo3.reload.state).to eq('pending') expect(other_user_todo.reload.state).to eq('pending') - updated_todo_ids = mutation_response['updatedIds'] + updated_todo_ids = mutation_response['todos'] expect(updated_todo_ids).to be_empty end diff --git a/spec/requests/api/graphql/mutations/todos/restore_many_spec.rb b/spec/requests/api/graphql/mutations/todos/restore_many_spec.rb index 3e96d5c5058d1643f64f51bdb878d1dafc864b7b..e71a232ff7c4038987a56ff694f28fa30acab70e 100644 --- a/spec/requests/api/graphql/mutations/todos/restore_many_spec.rb +++ b/spec/requests/api/graphql/mutations/todos/restore_many_spec.rb @@ -22,7 +22,6 @@ <<-QL.strip_heredoc clientMutationId errors - updatedIds todos { id state @@ -44,7 +43,6 @@ def mutation_response expect(mutation_response).to include( 'errors' => be_empty, - 'updatedIds' => match_array(input_ids), 'todos' => contain_exactly( { 'id' => global_id_of(todo1), 'state' => 'pending' }, { 'id' => global_id_of(todo2), 'state' => 'pending' }