-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ignore directive replacements for consolidated types when defini…
…tionType is input/output (#119) * unit test * make test pass * improve test * fix integration tests * fix integration tests * fix integration tests
- Loading branch information
1 parent
85a3257
commit 3a8e3c1
Showing
13 changed files
with
115 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@expediagroup/graphql-kotlin-codegen", | ||
"packageManager": "[email protected].17", | ||
"packageManager": "[email protected].32", | ||
"main": "dist/plugin.cjs", | ||
"types": "dist/plugin.d.cts", | ||
"files": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...nit/should_ignore_filtered_directiveReplacements_for_consolidated_types/codegen.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { GraphQLKotlinCodegenConfig } from "../../../src/plugin"; | ||
import { Kind } from "graphql/index"; | ||
|
||
export default { | ||
extraImports: ["should_honor_directiveReplacements_config.*"], | ||
directiveReplacements: [ | ||
{ | ||
directive: "directive1", | ||
kotlinAnnotations: ["@SomeAnnotation1"], | ||
definitionType: Kind.OBJECT_TYPE_DEFINITION, | ||
}, | ||
{ | ||
directive: "directive2", | ||
kotlinAnnotations: ["@SomeAnnotation2"], | ||
}, | ||
], | ||
classConsolidationEnabled: true, | ||
} satisfies GraphQLKotlinCodegenConfig; |
26 changes: 26 additions & 0 deletions
26
test/unit/should_ignore_filtered_directiveReplacements_for_consolidated_types/expected.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.kotlin.generated | ||
|
||
import com.expediagroup.graphql.generator.annotations.* | ||
import should_honor_directiveReplacements_config.* | ||
|
||
@SomeAnnotation1 | ||
@SomeAnnotation2 | ||
@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.OBJECT]) | ||
data class TypeThatShouldGetDirectiveReplacement( | ||
val field: String? = null | ||
) | ||
|
||
@SomeAnnotation2 | ||
@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.INPUT_OBJECT]) | ||
data class InputTypeThatShouldNotGetDirectiveReplacement( | ||
val field: String? = null | ||
) | ||
|
||
data class MyConsolidatedTypeWithDirectives( | ||
val field: String? = null | ||
) | ||
|
||
@SomeAnnotation2 | ||
data class MyConsolidatedTypeWithDirectives2( | ||
val field: String? = null | ||
) |
26 changes: 26 additions & 0 deletions
26
test/unit/should_ignore_filtered_directiveReplacements_for_consolidated_types/schema.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
directive @directive1 on INPUT_OBJECT | OBJECT | ||
directive @directive2 on INPUT_OBJECT | OBJECT | ||
|
||
type TypeThatShouldGetDirectiveReplacement @directive1 @directive2 { | ||
field: String | ||
} | ||
|
||
input InputTypeThatShouldNotGetDirectiveReplacement @directive1 @directive2 { | ||
field: String | ||
} | ||
|
||
type MyConsolidatedTypeWithDirectives @directive1 { | ||
field: String | ||
} | ||
|
||
input MyConsolidatedTypeWithDirectivesInput @directive1 { | ||
field: String | ||
} | ||
|
||
type MyConsolidatedTypeWithDirectives2 @directive2 { | ||
field: String | ||
} | ||
|
||
input MyConsolidatedTypeWithDirectives2Input @directive2 { | ||
field: String | ||
} |