Commit 3d4bd463 authored by Alex Kalderimis's avatar Alex Kalderimis

Change to IterationID, but support released type

This fixes an accidentally released type ID that is incorrect, and adds
a spec that verifies that we both support the new type name and the
accidentally released one.
parent 0d6655c0
......@@ -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: EEIterationID!
id: IterationID!
): Iteration
"""
......
......@@ -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": "EEIterationID",
"name": "IterationID",
"ofType": null
}
},
......@@ -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
......
# 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
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