Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a33a602f
Commit
a33a602f
authored
Aug 14, 2020
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ajk-globalid-ignore-ee' into 'master'
Ajk globalid ignore EE See merge request gitlab-org/gitlab!39478
parents
a41449a1
3d4bd463
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
18 deletions
+89
-18
app/graphql/gitlab_schema.rb
app/graphql/gitlab_schema.rb
+14
-0
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+6
-6
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+11
-11
ee/app/graphql/ee/types/query_type.rb
ee/app/graphql/ee/types/query_type.rb
+1
-1
ee/spec/graphql/types/global_id_type_spec.rb
ee/spec/graphql/types/global_id_type_spec.rb
+57
-0
No files found.
app/graphql/gitlab_schema.rb
View file @
a33a602f
...
...
@@ -48,6 +48,13 @@ class GitlabSchema < GraphQL::Schema
super
(
query_str
,
**
kwargs
)
end
def
get_type
(
type_name
)
# This is a backwards compatibility hack to work around an accidentally
# released argument typed as EEIterationID
type_name
=
type_name
.
gsub
(
/^EE/
,
''
)
if
type_name
.
end_with?
(
'ID'
)
super
(
type_name
)
end
def
id_from_object
(
object
,
_type
=
nil
,
_ctx
=
nil
)
unless
object
.
respond_to?
(
:to_global_id
)
# This is an error in our schema and needs to be solved. So raise a
...
...
@@ -144,6 +151,13 @@ class GitlabSchema < GraphQL::Schema
end
end
end
# This is a backwards compatibility hack to work around an accidentally
# released argument typed as EE{Type}ID
def
get_type
(
type_name
)
type_name
=
type_name
.
gsub
(
/^EE/
,
''
)
if
type_name
.
end_with?
(
'ID'
)
super
(
type_name
)
end
end
GitlabSchema
.
prepend_if_ee
(
'EE::GitlabSchema'
)
# rubocop: disable Cop/InjectEnterpriseEditionModule
...
...
doc/api/graphql/reference/gitlab_schema.graphql
View file @
a33a602f
...
...
@@ -4383,11 +4383,6 @@ type DismissVulnerabilityPayload {
vulnerability
:
Vulnerability
}
"""
Identifier of EE::Iteration
"""
scalar
EEIterationID
interface
Entry
{
"""
Flat
path
of
the
entry
...
...
@@ -7805,6 +7800,11 @@ type IterationEdge {
node
:
Iteration
}
"""
Identifier of Iteration
"""
scalar
IterationID
"""
State of a GitLab iteration
"""
...
...
@@ -12270,7 +12270,7 @@ type Query {
"""
Find
an
iteration
by
its
ID
"""
id
:
EE
IterationID
!
id
:
IterationID
!
):
Iteration
"""
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
a33a602f
...
...
@@ -12201,16 +12201,6 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "SCALAR",
"name": "EEIterationID",
"description": "Identifier of EE::Iteration",
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{
"kind": "INTERFACE",
"name": "Entry",
...
...
@@ -21532,6 +21522,16 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "SCALAR",
"name": "IterationID",
"description": "Identifier of Iteration",
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{
"kind": "ENUM",
"name": "IterationState",
...
...
@@ -36095,7 +36095,7 @@
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "
EE
IterationID",
"name": "IterationID",
"ofType": null
}
},
ee/app/graphql/ee/types/query_type.rb
View file @
a33a602f
...
...
@@ -10,7 +10,7 @@ module EE
null:
true
,
resolve:
->
(
_obj
,
args
,
_ctx
)
{
::
GitlabSchema
.
find_by_gid
(
args
[
:id
])
},
description:
'Find an iteration'
do
argument
:id
,
::
Types
::
GlobalIDType
[
Iteration
],
argument
:id
,
::
Types
::
GlobalIDType
[
::
Iteration
],
required:
true
,
description:
'Find an iteration by its ID'
end
...
...
ee/spec/graphql/types/global_id_type_spec.rb
0 → 100644
View file @
a33a602f
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Types
::
GlobalIDType
do
context
'where we declare an argument as GlobalIDType[a] where a is prepended in EE'
do
def
query
(
doc
,
vars
)
GraphQL
::
Query
.
new
(
GitlabSchema
.
graphql_definition
,
document:
doc
,
context:
{},
variables:
vars
)
end
def
run_query
(
gql_query
,
vars
)
query
(
GraphQL
.
parse
(
gql_query
),
vars
).
result
end
let_it_be
(
:iteration
)
{
create
(
:iteration
)
}
shared_examples
'a working query'
do
it
'works'
do
res
=
run_query
(
document
,
'iterationId'
=>
iteration
.
to_global_id
.
to_s
)
expect
(
res
[
'errors'
]).
to
be_blank
expect
(
res
.
dig
(
'data'
,
'iteration'
)).
to
eq
(
'iid'
=>
iteration
.
iid
.
to_s
,
'id'
=>
iteration
.
to_global_id
.
to_s
)
end
end
context
'when the argument is declared by the client as IterationID'
do
let
(
:document
)
do
<<-
GRAPHQL
query($iterationId: IterationID!) {
iteration(id: $iterationId) {
id, iid
}
}
GRAPHQL
end
it_behaves_like
'a working query'
end
context
'when the argument is declared by the client as EEIterationID'
do
let
(
:document
)
do
<<-
GRAPHQL
query($iterationId: EEIterationID!) {
iteration(id: $iterationId) {
id, iid
}
}
GRAPHQL
end
it_behaves_like
'a working query'
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment