GraphQL 4.0 naming of generated objects #1128
-
Hi, I am currently trying to move from graphql 3.7 to graphql 4.0 So far I do like the changes made a lot and most is straight forward. Example: I have a schema: schema {
query: Query
}
type SomeType {
name: String
someOtherVariable: String
}
type Query {
foo(variable: String): SomeType
}
then I generate 2 queries: query Query1($variabe: String!) {
partner(variable: $variabe) {
name
}
} query Query2($variabe: String!) {
partner(variable: $variabe) {
name
someOtherVariable: String
}
} In the end I end up with 2 classes and 2 packages, in both packages there is a file My Question is now, how I can change the name of My solution is to introduce an import alias, but I was wondering if there is an option that I can use to change that? I use the plugin `` and my setup is as follows: graphql {
client {
packageName = "my.package"
endpoint = "http://some-url.com/graphql"
headers = mutableMapOf("foo" to "bar")
customScalars = listOf(
GraphQLScalar("LocalDate", "java.time.LocalDate", "my.package.LocalDateScalarConverter"),
GraphQLScalar("Url", "java.net.URI", "my.package.UriScalarConverter")
)
queryFiles = fileTree("src/main/resources/graphql-queries").files.toMutableList()
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello 👋 |
Beta Was this translation helpful? Give feedback.
Hello 👋
Using aliases is the way to go. We currently don't have any plans to generate common output types (similar to input types and enums) but it might change in the future. We are always open to contributions!