Skip to content

Commit 66d5928

Browse files
committed
[federation] remove unnecessary extends on Fed 2 Query
`@extends` is no longer needed in Fed 2. Missed this in previous validation rule cleanup (#1581).
1 parent 8674135 commit 66d5928

File tree

10 files changed

+18
-14
lines changed

10 files changed

+18
-14
lines changed

examples/client/src/integration/wiremock/__files/schema.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ type ProductVariation {
155155
id: ID!
156156
}
157157

158-
type Query @extends {
158+
type Query {
159159
"Union of all types that use the @key directive, including both types native to the schema and extended types"
160160
_entities(representations: [_Any!]!): [_Entity]!
161161
_service: _Service!

generator/graphql-kotlin-federation/src/main/kotlin/com/expediagroup/graphql/generator/federation/FederatedSchemaGeneratorHooks.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,11 @@ open class FederatedSchemaGeneratorHooks(
204204
*/
205205
override fun didGenerateQueryObject(type: GraphQLObjectType): GraphQLObjectType = GraphQLObjectType.newObject(type)
206206
.field(SERVICE_FIELD_DEFINITION)
207-
.withAppliedDirective(EXTENDS_DIRECTIVE_TYPE.toAppliedDirective())
207+
.also {
208+
if (!optInFederationV2) {
209+
it.withAppliedDirective(EXTENDS_DIRECTIVE_TYPE.toAppliedDirective())
210+
}
211+
}
208212
.build()
209213

210214
/**

generator/graphql-kotlin-federation/src/test/kotlin/com/expediagroup/graphql/generator/federation/FederatedSchemaV2GeneratorTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class FederatedSchemaV2GeneratorTest {
116116
value: String!
117117
}
118118
119-
type Query @extends {
119+
type Query {
120120
"Union of all types that use the @key directive, including both types native to the schema and extended types"
121121
_entities(representations: [_Any!]!): [_Entity]!
122122
_service: _Service!

generator/graphql-kotlin-federation/src/test/kotlin/com/expediagroup/graphql/generator/federation/execution/ServiceQueryResolverTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ directive @shareable on OBJECT | FIELD_DEFINITION
120120
"Allows users to annotate fields and types with additional metadata information"
121121
directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
122122
123-
type Query @extends {
123+
type Query {
124124
_service: _Service!
125125
getSimpleNestedObject: [SelfReferenceObject]!
126126
hello(name: String!): String!
@@ -204,7 +204,7 @@ type CustomScalar {
204204
value: String!
205205
}
206206
207-
type Query @extends {
207+
type Query {
208208
"Union of all types that use the @key directive, including both types native to the schema and extended types"
209209
_entities(representations: [_Any!]!): [_Entity]!
210210
_service: _Service!

plugins/graphql-kotlin-gradle-plugin/src/test/kotlin/com/expediagroup/graphql/plugin/gradle/GraphQLGradlePluginIT.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ class GraphQLGradlePluginIT : GraphQLGradlePluginAbstractIT() {
574574
"Allows users to annotate fields and types with additional metadata information"
575575
directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
576576
577-
type Query @extends {
577+
type Query {
578578
_service: _Service!
579579
helloWorld(name: String): String!
580580
randomUUID: UUID!

plugins/graphql-kotlin-gradle-plugin/src/test/kotlin/com/expediagroup/graphql/plugin/gradle/tasks/GraphQLGenerateSDLTaskIT.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ internal val FEDERATED_SCHEMA =
123123
"Allows users to annotate fields and types with additional metadata information"
124124
directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
125125
126-
type Query @extends {
126+
type Query {
127127
_service: _Service!
128128
helloWorld(name: String): String!
129129
}

plugins/graphql-kotlin-maven-plugin/src/integration/generate-sdl-federated/src/test/kotlin/com/expediagroup/graphql/plugin/maven/GenerateSDLMojoTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class GenerateSDLMojoTest {
9494
"Allows users to annotate fields and types with additional metadata information"
9595
directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
9696
97-
type Query @extends {
97+
type Query {
9898
_service: _Service!
9999
helloWorld(name: String): String!
100100
}

plugins/graphql-kotlin-maven-plugin/src/integration/generate-sdl-hooks/src/test/kotlin/com/expediagroup/graphql/plugin/maven/GenerateSDLMojoTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class GenerateSDLMojoTest {
9494
"Allows users to annotate fields and types with additional metadata information"
9595
directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
9696
97-
type Query @extends {
97+
type Query {
9898
_service: _Service!
9999
helloWorld(name: String): String!
100100
randomUUID: UUID!

plugins/schema/graphql-kotlin-sdl-generator/src/integrationTest/kotlin/com/expediagroup/graphql/plugin/schema/GenerateCustomSDLTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class GenerateCustomSDLTest {
8383
"Allows users to annotate fields and types with additional metadata information"
8484
directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
8585
86-
type Query @extends {
86+
type Query {
8787
_service: _Service!
8888
helloWorld(name: String): String!
8989
randomUUID: UUID!

website/docs/schema-generator/federation/federated-schemas.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ type Product @key(fields : "id") {
6262
id: Int!
6363
}
6464

65-
type Query @extends {
65+
type Query {
6666
_entities(representations: [_Any!]!): [_Entity]!
6767
_service: _Service!
6868
product(id: Int!): Product
@@ -121,12 +121,12 @@ schema {
121121

122122
union _Entity = Product
123123

124-
type Product @extends @key(fields : "id") {
125-
id: Int! @external
124+
type Product @key(fields : "id") {
125+
id: Int!
126126
reviews: [Review!]!
127127
}
128128

129-
type Query @extends {
129+
type Query {
130130
_entities(representations: [_Any!]!): [_Entity]!
131131
_service: _Service!
132132
}

0 commit comments

Comments
 (0)