dgs-codegen
dgs-codegen copied to clipboard
Regression in behaviour of generation in combination with typeMappings [>=4.4.7]
I found a regression while upgrading codegen from 4.4.6 to the latest 5.0.2 but also 4.4.7 fails.
I have a custom PageInfo type like:
type PageInfo {
hasNextPage: Boolean!
hasPreviousPage: Boolean!
totalCount: Int!
}
used in e.g.:
type EngineManufacturerPage {
items: [EngineManufacturer!]!
pageInfo: PageInfo!
}
and a DGS code generator config for it like:
packageName = "com.mycomp.graphql"
subPackageNameTypes = "type"
generateInterfaces = true
typeMapping = ["PageInfo": "com.mycomp.graphql.type.IPageInfo"]
In 4.4.6 and before above graphqls would generate a IPageInfo like:
public interface IPageInfo {
Boolean getHasNextPage();
Boolean getHasPreviousPage();
Integer getTotalCount();
}
but from 4.4.7 this is not happening anymore unfortunately...
Could it be something changed in the behaviour?
Other interfaces are generated so I suspect the combination with the typeMapping configuration.
Basically, I want to use my own PageInfo object as defined in my schema and not the graphql.relay.PageInfo which was used because of the defined commonScalars in the generator here:
https://github.com/Netflix/dgs-codegen/blob/34e5d46bd0d1a0bdf87997d124843ab1a39f8c3a/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/java/TypeUtils.kt#L45
To avoid it (graphql.relay.PageInfo) I defined the typeMapping = ["PageInfo": "com.mycomp.graphql.type.IPageInfo"].
Is there a way to remove a common scalar from the generator config?
I have the same issue and am also using typeMapping to side step the default relay PageInfo, but this results in the generated PageInfo from my schema not being generated...
Same here. Would very much like it if codegen didn't assume I wanted to use graphql-java's implementation of Relay pagination, or there was a way to explicitly disable that behavior (especially if the schema never makes use of @connection and graphql-dgs-pagination isn't an explicit dependency).