Commit a3326387 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'msj-id-docs' into 'master'

Lint for uppercase ID in docs and GraphQL API

See merge request gitlab-org/gitlab!39687
parents 8f910d12 eb3d795b
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
"Gzip", "Gzip",
"Helm", "Helm",
"HipChat", "HipChat",
"ID",
"Ingress", "Ingress",
"jasmine-jquery", "jasmine-jquery",
"JavaScript", "JavaScript",
......
...@@ -116,11 +116,11 @@ class GitlabSchema < GraphQL::Schema ...@@ -116,11 +116,11 @@ class GitlabSchema < GraphQL::Schema
expected_type = ctx[:expected_type] expected_type = ctx[:expected_type]
gid = GlobalID.parse(global_id) gid = GlobalID.parse(global_id)
raise Gitlab::Graphql::Errors::ArgumentError, "#{global_id} is not a valid GitLab id." unless gid raise Gitlab::Graphql::Errors::ArgumentError, "#{global_id} is not a valid GitLab ID." unless gid
if expected_type && !gid.model_class.ancestors.include?(expected_type) if expected_type && !gid.model_class.ancestors.include?(expected_type)
vars = { global_id: global_id, expected_type: expected_type } vars = { global_id: global_id, expected_type: expected_type }
msg = _('%{global_id} is not a valid id for %{expected_type}.') % vars msg = _('%{global_id} is not a valid ID for %{expected_type}.') % vars
raise Gitlab::Graphql::Errors::ArgumentError, msg raise Gitlab::Graphql::Errors::ArgumentError, msg
end end
......
...@@ -12,7 +12,7 @@ module Mutations ...@@ -12,7 +12,7 @@ module Mutations
argument :id, argument :id,
GraphQL::ID_TYPE, GraphQL::ID_TYPE,
required: true, required: true,
description: 'The global id of the annotation to delete' description: 'The global ID of the annotation to delete'
def resolve(id:) def resolve(id:)
annotation = authorized_find!(id: id) annotation = authorized_find!(id: id)
......
...@@ -7,7 +7,7 @@ module Types ...@@ -7,7 +7,7 @@ module Types
graphql_name 'JiraUser' graphql_name 'JiraUser'
field :jira_account_id, GraphQL::STRING_TYPE, null: false, field :jira_account_id, GraphQL::STRING_TYPE, null: false,
description: 'Account id of the Jira user' description: 'Account ID of the Jira user'
field :jira_display_name, GraphQL::STRING_TYPE, null: false, field :jira_display_name, GraphQL::STRING_TYPE, null: false,
description: 'Display name of the Jira user' description: 'Display name of the Jira user'
field :jira_email, GraphQL::STRING_TYPE, null: true, field :jira_email, GraphQL::STRING_TYPE, null: true,
......
...@@ -37,7 +37,7 @@ The following steps enable AWS Cognito as an authentication provider: ...@@ -37,7 +37,7 @@ The following steps enable AWS Cognito as an authentication provider:
1. Save changes for the app client settings. 1. Save changes for the app client settings.
1. Under **Domain name** include the AWS domain name for your AWS Cognito application. 1. Under **Domain name** include the AWS domain name for your AWS Cognito application.
1. Under **App Clients**, find your **App client id** and **App client secret**. These values correspond to the OAuth2 Client ID and Client Secret. Save these values. 1. Under **App Clients**, find your app client ID and app client secret. These values correspond to the OAuth2 Client ID and Client Secret. Save these values.
## Configure GitLab ## Configure GitLab
......
...@@ -38,7 +38,7 @@ value that was randomly generated by GitLab for the request. ...@@ -38,7 +38,7 @@ value that was randomly generated by GitLab for the request.
See the following example: See the following example:
![Firefox's network monitor showing an request id header](img/network_monitor_xid.png) ![Firefox's network monitor showing an request ID header](img/network_monitor_xid.png)
### Getting the correlation ID from your logs ### Getting the correlation ID from your logs
......
...@@ -212,11 +212,11 @@ PUT /projects/:id/feature_flags/:feature_flag_name ...@@ -212,11 +212,11 @@ PUT /projects/:id/feature_flags/:feature_flag_name
| `active` | boolean | no | The active state of the flag. [Supported](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38350) in GitLab 13.3 and later. | | `active` | boolean | no | The active state of the flag. [Supported](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38350) in GitLab 13.3 and later. |
| `name` | string | no | The new name of the feature flag. [Supported](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38350) in GitLab 13.3 and later. | | `name` | string | no | The new name of the feature flag. [Supported](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38350) in GitLab 13.3 and later. |
| `strategies` | JSON | no | The feature flag [strategies](../operations/feature_flags.md#feature-flag-strategies). | | `strategies` | JSON | no | The feature flag [strategies](../operations/feature_flags.md#feature-flag-strategies). |
| `strategies:id` | JSON | no | The feature flag strategy id. | | `strategies:id` | JSON | no | The feature flag strategy ID. |
| `strategies:name` | JSON | no | The strategy name. | | `strategies:name` | JSON | no | The strategy name. |
| `strategies:parameters` | JSON | no | The strategy parameters. | | `strategies:parameters` | JSON | no | The strategy parameters. |
| `strategies:scopes` | JSON | no | The scopes for the strategy. | | `strategies:scopes` | JSON | no | The scopes for the strategy. |
| `strategies:scopes:id` | JSON | no | The scopes id. | | `strategies:scopes:id` | JSON | no | The scopes ID. |
| `strategies:scopes:environment_scope` | string | no | The environment spec for the scope. | | `strategies:scopes:environment_scope` | string | no | The environment spec for the scope. |
```shell ```shell
......
...@@ -192,7 +192,7 @@ When you see the result `id` of the note you created - take a note of it. Now le ...@@ -192,7 +192,7 @@ When you see the result `id` of the note you created - take a note of it. Now le
```graphql ```graphql
mutation { mutation {
updateNote(input: { id: "gid://gitlab/Note/<note id>", updateNote(input: { id: "gid://gitlab/Note/<note ID>",
body: "*SIPS TEA*" body: "*SIPS TEA*"
}) { }) {
note { note {
...@@ -210,7 +210,7 @@ Let's delete the comment, since our tea is all gone. ...@@ -210,7 +210,7 @@ Let's delete the comment, since our tea is all gone.
```graphql ```graphql
mutation { mutation {
destroyNote(input: { id: "gid://gitlab/Note/<note id>" }) { destroyNote(input: { id: "gid://gitlab/Note/<note ID>" }) {
note { note {
id id
body body
......
...@@ -3131,7 +3131,7 @@ input DeleteAnnotationInput { ...@@ -3131,7 +3131,7 @@ input DeleteAnnotationInput {
clientMutationId: String clientMutationId: String
""" """
The global id of the annotation to delete The global ID of the annotation to delete
""" """
id: ID! id: ID!
} }
...@@ -8176,7 +8176,7 @@ type JiraUser { ...@@ -8176,7 +8176,7 @@ type JiraUser {
gitlabUsername: String gitlabUsername: String
""" """
Account id of the Jira user Account ID of the Jira user
""" """
jiraAccountId: String! jiraAccountId: String!
......
...@@ -8464,7 +8464,7 @@ ...@@ -8464,7 +8464,7 @@
"inputFields": [ "inputFields": [
{ {
"name": "id", "name": "id",
"description": "The global id of the annotation to delete", "description": "The global ID of the annotation to delete",
"type": { "type": {
"kind": "NON_NULL", "kind": "NON_NULL",
"name": null, "name": null,
...@@ -22659,7 +22659,7 @@ ...@@ -22659,7 +22659,7 @@
}, },
{ {
"name": "jiraAccountId", "name": "jiraAccountId",
"description": "Account id of the Jira user", "description": "Account ID of the Jira user",
"args": [ "args": [
], ],
...@@ -1254,7 +1254,7 @@ Autogenerated return type of JiraImportUsers ...@@ -1254,7 +1254,7 @@ Autogenerated return type of JiraImportUsers
| `gitlabId` | Int | ID of the matched GitLab user | | `gitlabId` | Int | ID of the matched GitLab user |
| `gitlabName` | String | Name of the matched GitLab user | | `gitlabName` | String | Name of the matched GitLab user |
| `gitlabUsername` | String | Username of the matched GitLab user | | `gitlabUsername` | String | Username of the matched GitLab user |
| `jiraAccountId` | String! | Account id of the Jira user | | `jiraAccountId` | String! | Account ID of the Jira user |
| `jiraDisplayName` | String! | Display name of the Jira user | | `jiraDisplayName` | String! | Display name of the Jira user |
| `jiraEmail` | String | Email of the Jira user, returned only for users with public emails | | `jiraEmail` | String | Email of the Jira user, returned only for users with public emails |
......
...@@ -807,7 +807,7 @@ Parameters: ...@@ -807,7 +807,7 @@ Parameters:
| `username` | string | yes | The username of the user created to be used with GitLab/Jira. | | `username` | string | yes | The username of the user created to be used with GitLab/Jira. |
| `password` | string | yes | The password of the user created to be used with GitLab/Jira. | | `password` | string | yes | The password of the user created to be used with GitLab/Jira. |
| `active` | boolean | no | Activates or deactivates the service. Defaults to false (deactivated). | | `active` | boolean | no | Activates or deactivates the service. Defaults to false (deactivated). |
| `jira_issue_transition_id` | string | no | The ID of a transition that moves issues to a closed state. You can find this number under the Jira workflow administration (**Administration > Issues > Workflows**) by selecting **View** under **Operations** of the desired workflow of your project. The ID of each state can be found inside the parenthesis of each transition name under the **Transitions (id)** column. By default, this ID is set to `2`. | | `jira_issue_transition_id` | string | no | The ID of a transition that moves issues to a closed state. You can find this number under the Jira workflow administration (**Administration > Issues > Workflows**) by selecting **View** under **Operations** of the desired workflow of your project. The ID of each state can be found inside the parenthesis of each transition name under the transitions ID column. By default, this ID is set to `2`. |
| `commit_events` | boolean | false | Enable notifications for commit events | | `commit_events` | boolean | false | Enable notifications for commit events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events | | `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `comment_on_event_enabled` | boolean | false | Enable comments inside Jira issues on each GitLab event (commit / merge request) | | `comment_on_event_enabled` | boolean | false | Enable comments inside Jira issues on each GitLab event (commit / merge request) |
......
...@@ -106,5 +106,5 @@ can opt to disable it for your instance: ...@@ -106,5 +106,5 @@ can opt to disable it for your instance:
# Instance-wide # Instance-wide
Feature.disable(:dag_pipeline_tab) Feature.disable(:dag_pipeline_tab)
# or by project # or by project
Feature.disable(:dag_pipeline_tab, Project.find(<project id>)) Feature.disable(:dag_pipeline_tab, Project.find(<project ID>))
``` ```
...@@ -75,7 +75,7 @@ To enable it: ...@@ -75,7 +75,7 @@ To enable it:
# Instance-wide # Instance-wide
Feature.enable(:<feature flag>) Feature.enable(:<feature flag>)
# or by project # or by project
Feature.enable(:<feature flag>, Project.find(<project id>)) Feature.enable(:<feature flag>, Project.find(<project ID>))
``` ```
To disable it: To disable it:
...@@ -84,7 +84,7 @@ To disable it: ...@@ -84,7 +84,7 @@ To disable it:
# Instance-wide # Instance-wide
Feature.disable(:<feature flag>) Feature.disable(:<feature flag>)
# or by project # or by project
Feature.disable(:<feature flag>, Project.find(<project id>)) Feature.disable(:<feature flag>, Project.find(<project ID>))
``` ```
```` ````
......
...@@ -229,7 +229,7 @@ be used both locally in development and on any deployed GitLab instance to ...@@ -229,7 +229,7 @@ be used both locally in development and on any deployed GitLab instance to
diagnose poor search performance. This will show the exact queries being made, diagnose poor search performance. This will show the exact queries being made,
which is useful to diagnose why a search might be slow. which is useful to diagnose why a search might be slow.
### Correlation ID and X-Opaque-Id ### Correlation ID and `X-Opaque-Id`
Our [correlation Our [correlation
ID](./distributed_tracing.md#developer-guidelines-for-working-with-correlation-ids) ID](./distributed_tracing.md#developer-guidelines-for-working-with-correlation-ids)
......
...@@ -128,7 +128,7 @@ When this is set in place, it's easy to access the replicator through ...@@ -128,7 +128,7 @@ When this is set in place, it's easy to access the replicator through
the model: the model:
```ruby ```ruby
package_file = Packages::PackageFile.find(4) # just a random id as example package_file = Packages::PackageFile.find(4) # just a random ID as example
replicator = package_file.replicator replicator = package_file.replicator
``` ```
......
...@@ -21,7 +21,7 @@ To get the credentials (a pair of Client ID and Client Secret), you must [create ...@@ -21,7 +21,7 @@ To get the credentials (a pair of Client ID and Client Secret), you must [create
1. Select **API (Enable OAuth Settings)** and click on **Enable OAuth Settings**. 1. Select **API (Enable OAuth Settings)** and click on **Enable OAuth Settings**.
1. Fill in the application details into the following fields: 1. Fill in the application details into the following fields:
- **Callback URL**: The callback URL of your GitLab installation. For example, `https://gitlab.example.com/users/auth/salesforce/callback`. - **Callback URL**: The callback URL of your GitLab installation. For example, `https://gitlab.example.com/users/auth/salesforce/callback`.
- **Selected OAuth Scopes**: Move **Access your basic information (id, profile, email, address, phone)** and **Allow access to your unique identifier (OpenID)** to the right column. - **Selected OAuth Scopes**: Move `Access your basic information (id, profile, email, address, phone)` and `Allow access to your unique identifier (openid)` to the right column.
![Salesforce OAuth App Details](img/salesforce_oauth_app_details.png) ![Salesforce OAuth App Details](img/salesforce_oauth_app_details.png)
......
...@@ -332,8 +332,8 @@ unleash = Unleash::Client.new({ ...@@ -332,8 +332,8 @@ unleash = Unleash::Client.new({
}) })
unleash_context = Unleash::Context.new unleash_context = Unleash::Context.new
# Replace "123" with the id of an authenticated user. # Replace "123" with the ID of an authenticated user.
# Note that the context's user id must be a string: # Note that the context's user ID must be a string:
# https://unleash.github.io/docs/unleash_context # https://unleash.github.io/docs/unleash_context
unleash_context.user_id = "123" unleash_context.user_id = "123"
......
...@@ -33,7 +33,7 @@ To enable it: ...@@ -33,7 +33,7 @@ To enable it:
# Instance-wide # Instance-wide
Feature.enable(:product_analytics) Feature.enable(:product_analytics)
# or by project # or by project
Feature.enable(:product_analytics, Project.find(<project id>)) Feature.enable(:product_analytics, Project.find(<project ID>))
``` ```
To disable it: To disable it:
...@@ -42,7 +42,7 @@ To disable it: ...@@ -42,7 +42,7 @@ To disable it:
# Instance-wide # Instance-wide
Feature.disable(:product_analytics) Feature.disable(:product_analytics)
# or by project # or by project
Feature.disable(:product_analytics, Project.find(<project id>)) Feature.disable(:product_analytics, Project.find(<project ID>))
``` ```
## Access Product Analytics ## Access Product Analytics
......
...@@ -678,7 +678,7 @@ To enable On-demand Scans: ...@@ -678,7 +678,7 @@ To enable On-demand Scans:
# Instance-wide # Instance-wide
Feature.enable(:security_on_demand_scans_feature_flag) Feature.enable(:security_on_demand_scans_feature_flag)
# or by project # or by project
Feature.enable(:security_on_demand_scans_feature_flag, Project.find(<project id>)) Feature.enable(:security_on_demand_scans_feature_flag, Project.find(<project ID>))
``` ```
#### Enable or disable site profiles #### Enable or disable site profiles
...@@ -703,7 +703,7 @@ To enable Site Profiles: ...@@ -703,7 +703,7 @@ To enable Site Profiles:
# Instance-wide # Instance-wide
Feature.enable(:security_on_demand_scans_site_profiles_feature_flag) Feature.enable(:security_on_demand_scans_site_profiles_feature_flag)
# or by project # or by project
Feature.enable(:security_on_demand_scans_site_profiles_feature_flag, Project.find(<project id>)) Feature.enable(:security_on_demand_scans_site_profiles_feature_flag, Project.find(<project ID>))
``` ```
## Reports ## Reports
......
...@@ -76,7 +76,7 @@ To enable it: ...@@ -76,7 +76,7 @@ To enable it:
# Instance-wide # Instance-wide
Feature.enable(:group_iterations) Feature.enable(:group_iterations)
# or by group # or by group
Feature.enable(:group_iterations, Group.find(<group id>)) Feature.enable(:group_iterations, Group.find(<group ID>))
``` ```
To disable it: To disable it:
...@@ -85,7 +85,7 @@ To disable it: ...@@ -85,7 +85,7 @@ To disable it:
# Instance-wide # Instance-wide
Feature.disable(:group_iterations) Feature.disable(:group_iterations)
# or by group # or by group
Feature.disable(:group_iterations, Group.find(<group id>)) Feature.disable(:group_iterations, Group.find(<group ID>))
``` ```
<!-- ## Troubleshooting <!-- ## Troubleshooting
......
...@@ -133,7 +133,7 @@ To enable it: ...@@ -133,7 +133,7 @@ To enable it:
# Instance-wide # Instance-wide
Feature.enable(:squash_options) Feature.enable(:squash_options)
# or by project # or by project
Feature.enable(:squash_options, Project.find(<project id>)) Feature.enable(:squash_options, Project.find(<project ID>))
``` ```
To disable it: To disable it:
...@@ -142,7 +142,7 @@ To disable it: ...@@ -142,7 +142,7 @@ To disable it:
# Instance-wide # Instance-wide
Feature.disable(:squash_options) Feature.disable(:squash_options)
# or by project # or by project
Feature.disable(:squash_options, Project.find(<project id>)) Feature.disable(:squash_options, Project.find(<project ID>))
``` ```
<!-- ## Troubleshooting <!-- ## Troubleshooting
......
...@@ -422,7 +422,7 @@ msgstr "" ...@@ -422,7 +422,7 @@ msgstr ""
msgid "%{firstMilestoneName} + %{numberOfOtherMilestones} more" msgid "%{firstMilestoneName} + %{numberOfOtherMilestones} more"
msgstr "" msgstr ""
msgid "%{global_id} is not a valid id for %{expected_type}." msgid "%{global_id} is not a valid ID for %{expected_type}."
msgstr "" msgstr ""
msgid "%{group_docs_link_start}Groups%{group_docs_link_end} allow you to manage and collaborate across multiple projects. Members of a group have access to all of its projects." msgid "%{group_docs_link_start}Groups%{group_docs_link_end} allow you to manage and collaborate across multiple projects. Members of a group have access to all of its projects."
......
...@@ -51,7 +51,7 @@ RSpec.describe Mutations::Discussions::ToggleResolve do ...@@ -51,7 +51,7 @@ RSpec.describe Mutations::Discussions::ToggleResolve do
it 'raises an error' do it 'raises an error' do
expect { subject }.to raise_error( expect { subject }.to raise_error(
Gitlab::Graphql::Errors::ArgumentError, Gitlab::Graphql::Errors::ArgumentError,
"#{discussion.to_global_id} is not a valid id for Discussion." "#{discussion.to_global_id} is not a valid ID for Discussion."
) )
end end
end end
......
...@@ -101,7 +101,7 @@ RSpec.describe Mutations::Metrics::Dashboard::Annotations::Create do ...@@ -101,7 +101,7 @@ RSpec.describe Mutations::Metrics::Dashboard::Annotations::Create do
graphql_mutation(:create_annotation, variables) graphql_mutation(:create_annotation, variables)
end end
it_behaves_like 'a mutation that returns top-level errors', errors: ['invalid_id is not a valid GitLab id.'] it_behaves_like 'a mutation that returns top-level errors', errors: ['invalid_id is not a valid GitLab ID.']
end end
end end
end end
...@@ -188,7 +188,7 @@ RSpec.describe Mutations::Metrics::Dashboard::Annotations::Create do ...@@ -188,7 +188,7 @@ RSpec.describe Mutations::Metrics::Dashboard::Annotations::Create do
graphql_mutation(:create_annotation, variables) graphql_mutation(:create_annotation, variables)
end end
it_behaves_like 'a mutation that returns top-level errors', errors: ['invalid_id is not a valid GitLab id.'] it_behaves_like 'a mutation that returns top-level errors', errors: ['invalid_id is not a valid GitLab ID.']
end end
end end
......
...@@ -45,7 +45,7 @@ RSpec.describe Mutations::Metrics::Dashboard::Annotations::Delete do ...@@ -45,7 +45,7 @@ RSpec.describe Mutations::Metrics::Dashboard::Annotations::Delete do
graphql_mutation(:delete_annotation, variables) graphql_mutation(:delete_annotation, variables)
end end
it_behaves_like 'a mutation that returns top-level errors', errors: ['invalid_id is not a valid GitLab id.'] it_behaves_like 'a mutation that returns top-level errors', errors: ['invalid_id is not a valid GitLab ID.']
end end
context 'when the delete fails' do context 'when the delete fails' do
......
...@@ -80,7 +80,7 @@ RSpec.describe 'Marking todos done' do ...@@ -80,7 +80,7 @@ RSpec.describe 'Marking todos done' do
context 'when using an invalid gid' do context 'when using an invalid gid' do
let(:input) { { id: 'invalid_gid' } } let(:input) { { id: 'invalid_gid' } }
let(:invalid_gid_error) { 'invalid_gid is not a valid GitLab id.' } let(:invalid_gid_error) { 'invalid_gid is not a valid GitLab ID.' }
it 'contains the expected error' do it 'contains the expected error' do
post_graphql_mutation(mutation, current_user: current_user) post_graphql_mutation(mutation, current_user: current_user)
......
...@@ -80,7 +80,7 @@ RSpec.describe 'Restoring Todos' do ...@@ -80,7 +80,7 @@ RSpec.describe 'Restoring Todos' do
context 'when using an invalid gid' do context 'when using an invalid gid' do
let(:input) { { id: 'invalid_gid' } } let(:input) { { id: 'invalid_gid' } }
let(:invalid_gid_error) { 'invalid_gid is not a valid GitLab id.' } let(:invalid_gid_error) { 'invalid_gid is not a valid GitLab ID.' }
it 'contains the expected error' do it 'contains the expected error' do
post_graphql_mutation(mutation, current_user: current_user) post_graphql_mutation(mutation, current_user: current_user)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment