Skip to content

Commit 3fd161e

Browse files
author
Oryan M
committed
Merge branch 'master' into KammererTob_master
# Conflicts: # src/test/groovy/graphql/kickstart/tools/SchemaParserSpec.groovy
2 parents 30418ba + faf59af commit 3fd161e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3073
-3322
lines changed

pom.xml

+6-25
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
<properties>
1515
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1616
<java.version>1.8</java.version>
17-
<kotlin.version>1.3.72</kotlin.version>
18-
<kotlin-coroutines.version>1.3.9</kotlin-coroutines.version>
17+
<kotlin.version>1.4.21</kotlin.version>
18+
<kotlin-coroutines.version>1.4.2</kotlin-coroutines.version>
1919
<jackson.version>2.10.3</jackson.version>
20-
<graphql-java.version>16.1</graphql-java.version>
20+
<graphql-java.version>16.2</graphql-java.version>
2121

2222
<maven.compiler.source>${java.version}</maven.compiler.source>
2323
<maven.compiler.target>${java.version}</maven.compiler.target>
@@ -155,9 +155,9 @@
155155
</exclusions>
156156
</dependency>
157157
<dependency>
158-
<groupId>org.spockframework</groupId>
159-
<artifactId>spock-core</artifactId>
160-
<version>1.0-groovy-2.4</version>
158+
<groupId>junit</groupId>
159+
<artifactId>junit</artifactId>
160+
<version>4.13.1</version>
161161
<scope>test</scope>
162162
</dependency>
163163
<dependency>
@@ -209,7 +209,6 @@
209209
<configuration>
210210
<sources>
211211
<source>src/test/kotlin</source>
212-
<source>src/test/groovy</source>
213212
</sources>
214213
</configuration>
215214
</execution>
@@ -240,23 +239,6 @@
240239
</plugin>
241240

242241

243-
<!-- Compile Groovy tests -->
244-
<plugin>
245-
<groupId>org.codehaus.gmavenplus</groupId>
246-
<artifactId>gmavenplus-plugin</artifactId>
247-
<version>1.5</version>
248-
<executions>
249-
<execution>
250-
<goals>
251-
<goal>generateStubs</goal>
252-
<goal>testGenerateStubs</goal>
253-
<goal>addTestSources</goal>
254-
<goal>testCompile</goal>
255-
</goals>
256-
</execution>
257-
</executions>
258-
</plugin>
259-
260242
<plugin>
261243
<groupId>org.apache.maven.plugins</groupId>
262244
<artifactId>maven-compiler-plugin</artifactId>
@@ -279,7 +261,6 @@
279261
</dependencies>
280262
<configuration>
281263
<includes>
282-
<include>**/*Spec.*</include>
283264
<include>**/*Test.*</include>
284265
</includes>
285266
</configuration>

src/main/kotlin/graphql/kickstart/tools/SchemaClassScanner.kt

+20-17
Original file line numberDiff line numberDiff line change
@@ -333,26 +333,29 @@ internal class SchemaClassScanner(
333333
}
334334

335335
is InputObjectTypeDefinition -> {
336-
graphQLType.inputValueDefinitions.forEach { inputValueDefinition ->
337-
val inputGraphQLType = inputValueDefinition.type.unwrap()
338-
if (inputGraphQLType is TypeName && !ScalarInfo.GRAPHQL_SPECIFICATION_SCALARS_DEFINITIONS.containsKey(inputGraphQLType.name)) {
339-
val inputValueJavaType = findInputValueType(inputValueDefinition.name, inputGraphQLType, javaType.unwrap())
340-
if (inputValueJavaType != null) {
341-
handleFoundType(typeClassMatcher.match(TypeClassMatcher.PotentialMatch.parameterType(
342-
inputValueDefinition.type,
343-
inputValueJavaType,
344-
GenericType(javaType, options).relativeToType(inputValueJavaType),
345-
InputObjectReference(inputValueDefinition)
346-
)))
347-
} else {
348-
var mappingAdvice = "Try adding it manually to the dictionary"
349-
if (javaType.unwrap().name.contains("Map")) {
350-
mappingAdvice = " or add a class to represent your input type instead of a Map."
336+
val inputObjectTypes = listOf(graphQLType) + inputExtensionDefinitions.filter { it.name == graphQLType.name }
337+
inputObjectTypes
338+
.flatMap { it.inputValueDefinitions }
339+
.forEach { inputValueDefinition ->
340+
val inputGraphQLType = inputValueDefinition.type.unwrap()
341+
if (inputGraphQLType is TypeName && !ScalarInfo.GRAPHQL_SPECIFICATION_SCALARS_DEFINITIONS.containsKey(inputGraphQLType.name)) {
342+
val inputValueJavaType = findInputValueType(inputValueDefinition.name, inputGraphQLType, javaType.unwrap())
343+
if (inputValueJavaType != null) {
344+
handleFoundType(typeClassMatcher.match(TypeClassMatcher.PotentialMatch.parameterType(
345+
inputValueDefinition.type,
346+
inputValueJavaType,
347+
GenericType(javaType, options).relativeToType(inputValueJavaType),
348+
InputObjectReference(inputValueDefinition)
349+
)))
350+
} else {
351+
var mappingAdvice = "Try adding it manually to the dictionary"
352+
if (javaType.unwrap().name.contains("Map")) {
353+
mappingAdvice = " or add a class to represent your input type instead of a Map."
354+
}
355+
log.warn("Cannot find definition for field '${inputValueDefinition.name}: ${inputGraphQLType.name}' on input type '${graphQLType.name}' -> ${javaType.unwrap().name}. $mappingAdvice")
351356
}
352-
log.warn("Cannot find definition for field '${inputValueDefinition.name}: ${inputGraphQLType.name}' on input type '${graphQLType.name}' -> ${javaType.unwrap().name}. $mappingAdvice")
353357
}
354358
}
355-
}
356359
}
357360
}
358361
}

src/main/kotlin/graphql/kickstart/tools/relay/RelayConnectionFactory.kt

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ import graphql.language.*
66
class RelayConnectionFactory : TypeDefinitionFactory {
77

88
override fun create(existing: MutableList<Definition<*>>): List<Definition<*>> {
9+
val connectionDirectives = findConnectionDirectives(existing)
10+
if (connectionDirectives.isEmpty()) {
11+
// do not add Relay definitions unless needed
12+
return emptyList()
13+
}
14+
915
val definitions = mutableListOf<Definition<*>>()
1016
val definitionsByName = existing.filterIsInstance<TypeDefinition<*>>()
1117
.associateBy { it.name }
1218
.toMutableMap()
1319

14-
findConnectionDirectives(existing)
20+
connectionDirectives
1521
.flatMap { createDefinitions(it) }
1622
.forEach {
1723
if (!definitionsByName.containsKey(it.name)) {

src/test/groovy/graphql/kickstart/tools/BuiltInIdSpec.groovy

-134
This file was deleted.

0 commit comments

Comments
 (0)