Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,3 @@ jobs:
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify

# The same jar has to work with the oldest supported graphql-java, so build and test against it too
graphql-java-25:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup java
uses: actions/setup-java@v6
with:
java-version: '11'
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v6
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify -Dgraphql-java.version=25.1
15 changes: 2 additions & 13 deletions src/main/kotlin/graphql/kickstart/tools/SdlDirectives.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ internal class SdlDirectives(
}

private fun isNonRepeatableByFirstDeclaration(directiveName: String): Boolean =
directiveDefinitions.find { it.name == directiveName }?.let { !it.isRepeatable } ?: BUILT_IN_DIRECTIVES.containsKey(directiveName)
directiveDefinitions.find { it.name == directiveName }?.let { !it.isRepeatable } ?: Directives.BUILT_IN_DIRECTIVES_MAP.containsKey(directiveName)

private fun createDirectives() {
schemaDirectives = directiveDefinitions.associateTo(linkedMapOf()) { it.name to createDirective(it) }
Expand Down Expand Up @@ -143,7 +143,7 @@ internal class SdlDirectives(
}
}

private fun findDirective(name: String): GraphQLDirective? = schemaDirectives[name] ?: BUILT_IN_DIRECTIVES[name]
private fun findDirective(name: String): GraphQLDirective? = schemaDirectives[name] ?: Directives.BUILT_IN_DIRECTIVES_MAP[name]

// there's no directive definition to look the type up in, so it's guessed from the value
private fun guessDirectiveArgumentType(directive: Directive, argumentName: String, value: Value<*>): GraphQLInputType {
Expand Down Expand Up @@ -239,14 +239,3 @@ internal class SdlDirectives(
}
}

// Built from the individual constants rather than Directives.BUILT_IN_DIRECTIVES_MAP (added in graphql-java 26)
// so that the library keeps working with graphql-java 25. TODO replace with Directives.BUILT_IN_DIRECTIVES_MAP once we deploy a major version
private val BUILT_IN_DIRECTIVES = listOf(
Directives.IncludeDirective,
Directives.SkipDirective,
Directives.DeprecatedDirective,
Directives.SpecifiedByDirective,
Directives.OneOfDirective,
Directives.DeferDirective,
Directives.ExperimentalDisableErrorPropagationDirective
).associateBy { it.name }
4 changes: 2 additions & 2 deletions src/test/kotlin/graphql/kickstart/tools/TypeExtensionTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class TypeExtensionTest {
assertEquals(date.description, "A date")
assertEquals(date.appliedDirectives.map { it.name }, listOf("format"))

// through GraphQLNamedSchemaElement, since graphql-java 25 and 26 disagree on which types have a nullable definition
assertEquals(listOf<GraphQLNamedSchemaElement>(fooBar, color, node, item, date).map { it.definition?.javaClass }, listOf(
val definitions = listOf(fooBar.definition, color.definition, node.definition, item.definition, date.definition)
assertEquals(definitions.map { it?.javaClass }, listOf(
UnionTypeDefinition::class.java,
EnumTypeDefinition::class.java,
InterfaceTypeDefinition::class.java,
Expand Down
Loading