File tree Expand file tree Collapse file tree 10 files changed +104
-16
lines changed
Expand file tree Collapse file tree 10 files changed +104
-16
lines changed Original file line number Diff line number Diff line change 2929 run : bun tsc
3030
3131 - name : Unit Tests
32- run : bun test
32+ run : bun unit
3333
3434 - uses : actions/setup-java@v4
3535 with :
Original file line number Diff line number Diff line change 11* .hbs
2+ test /integration /expected.graphql
Original file line number Diff line number Diff line change 1+ import com.expediagroup.graphql.plugin.gradle.graphql
2+
13repositories {
24 mavenCentral()
35}
46
57plugins {
68 kotlin(" jvm" ) version " 1.9.23"
9+ id(" com.expediagroup.graphql" ) version " 7.1.1"
710}
811
912dependencies {
1013 implementation(" com.expediagroup" , " graphql-kotlin-schema-generator" , " 7.1.1" )
14+ implementation(" com.expediagroup" , " graphql-kotlin-server" , " 7.1.1" )
1115 implementation(" com.expediagroup" , " graphql-kotlin-federation" , " 7.1.1" )
1216}
1317
1418sourceSets {
15- test {
19+ main {
1620 kotlin {
17- srcDirs(" test/unit" , " test/integration " )
21+ srcDirs(" test/unit" )
1822 exclude(" **/actual.kt" )
23+ srcDirs(" test/integration" )
1924 }
2025 }
2126}
27+
28+ graphql {
29+ schema {
30+ packages = listOf (" test.integration" )
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ import { GraphQLKotlinCodegenConfig } from "./src/plugin" ;
2+ import { CodegenConfig } from "@graphql-codegen/cli" ;
3+
4+ export default {
5+ overwrite : true ,
6+ schema : "test/**/*.graphql" ,
7+ config : {
8+ namingConvention : "keep" ,
9+ } ,
10+ generates : {
11+ "test/integration/Types.kt" : {
12+ plugins : [
13+ {
14+ "dist/plugin.cjs" : {
15+ resolverClasses : [
16+ {
17+ typeName : "Query" ,
18+ } ,
19+ ] ,
20+ } satisfies GraphQLKotlinCodegenConfig ,
21+ } ,
22+ ] ,
23+ } ,
24+ } ,
25+ } satisfies CodegenConfig ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ import com.types.generated.MyType
5151import com.types.generated.Query as QueryInterface
5252
5353class MyQuery : Query , QueryInterface () {
54- override suspend fun resolveMyType (input : String ): MyType =
54+ override fun resolveMyType (input : String ): MyType =
5555 MyType (
5656 field1 = myExpensiveCall1(),
5757 field2 = myExpensiveCall2()
@@ -103,7 +103,7 @@ import com.types.generated.MyType as MyTypeInterface
103103import com.expediagroup.graphql.generator.annotations.GraphQLIgnore
104104
105105class MyQuery : Query , QueryInterface () {
106- override suspend fun resolveMyType (input : String ): MyType = MyType ()
106+ override fun resolveMyType (input : String ): MyType = MyType ()
107107}
108108
109109@GraphQLIgnore
Original file line number Diff line number Diff line change 3939 "build" : " tsup src/plugin.ts --clean --dts --external graphql" ,
4040 "format" : " prettier --write ." ,
4141 "format-check" : " prettier --check ." ,
42- "integration" : " bun run build && graphql-codegen && ./gradlew build " ,
42+ "integration" : " bun run build && graphql-codegen && ./gradlew graphqlGenerateSDL && bun test ./test/integration.test.ts " ,
4343 "lint" : " eslint ." ,
4444 "prepack" : " bun run build" ,
4545 "prepare" : " husky" ,
46- "test " : " bun test"
46+ "unit " : " bun test ./test/plugin.test.ts "
4747 },
4848 "type" : " module"
4949}
Original file line number Diff line number Diff line change 1+ import { describe , expect , it } from "bun:test" ;
2+
3+ describe ( "Integration" , ( ) => {
4+ it ( "schema generated by GraphQL Kotlin should match expected" , async ( ) => {
5+ const generatedSchema = await Bun . file (
6+ `${ process . cwd ( ) } /build/schema.graphql` ,
7+ ) . text ( ) ;
8+ const expectedSchema = await Bun . file (
9+ `${ process . cwd ( ) } /test/integration/expected.graphql` ,
10+ ) . text ( ) ;
11+ expect ( generatedSchema ) . toBe ( expectedSchema ) ;
12+ } ) ;
13+ } ) ;
Original file line number Diff line number Diff line change 1+ package test.integration
2+
3+ import com.expediagroup.graphql.server.operations.Query
4+ import graphql.schema.DataFetchingEnvironment
5+ import test.integration.Query as QueryInterface
6+
7+ class IntegrationTestQuery () : Query, QueryInterface() {
8+ override fun testQuery (dataFetchingEnvironment : DataFetchingEnvironment ): SomeType = SomeType ()
9+ }
Original file line number Diff line number Diff line change 1+ schema {
2+ query : Query
3+ }
4+
5+ "Marks the field, argument, input field or enum value as deprecated"
6+ directive @deprecated (
7+ "The reason for the deprecation"
8+ reason : String = " No longer supported"
9+ ) on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION
10+
11+ "Directs the executor to include this field or fragment only when the `if` argument is true"
12+ directive @include (
13+ "Included when true."
14+ if : Boolean !
15+ ) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
16+
17+ "Indicates an Input Object is a OneOf Input Object."
18+ directive @oneOf on INPUT_OBJECT
19+
20+ "Directs the executor to skip this field or fragment when the `if` argument is true."
21+ directive @skip (
22+ "Skipped when true."
23+ if : Boolean !
24+ ) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
25+
26+ "Exposes a URL that specifies the behaviour of this scalar."
27+ directive @specifiedBy (
28+ "The URL that specifies the behaviour of this scalar."
29+ url : String !
30+ ) on SCALAR
31+
32+ type Query {
33+ testQuery : SomeType !
34+ }
35+
36+ type SomeType {
37+ someField : String
38+ }
You can’t perform that action at this time.
0 commit comments