Closed stahloss closed 1 year ago
I like very much this question : it's not possible yet.
The initial idea I had on this subject, was to either generate or not generate the controllers. But then, to override one controller, you would have to create (and maintain) all the controllers: not easy, especially for bug GraphQL schemas.
I guess your need is to replace on of the controllers for a specific need. Or do you need to replace all of them ?
Etienne
Yes it is inconvenient to have to create and maintain all of the controllers if you have a special case of one of them. This is the route I've taken now by only using the generatePojo
goal of the plugin and implementing the controllers myself
My need is to be able to exclude some GraphQL types from generating to a Controller
with SchemaMapping
, because these objects will be fetched in the controller of the parent type.
Maybe this could be achieved through plugin configuration or schema personalization?
I'll generate a spring autoconfiguration file, that will declare the controllers. This authorizes the use of the @Primary spring annotation, to replace such a declared bean. It will be in the next release.
That will also do :)
Thanks for the quick resolution and I'll be looking forward to the new release.
This is solved in the 2.1 release
Please take a look at the for more information on this page: https://github.com/graphql-java-generator/graphql-maven-plugin-project/wiki/server_migrate_1-x_to_2-x
Given a GraphQL non-scalar schema type "ABC", with version 1.x it was possible to not have separate data loaders for types by overriding
addWiringABC
methods, like so:Now non-scalar ABC type would not be data loaded.
After migrating to version 2.x and with it to spring-grapql,
@Controller
classes are generated with@SchemaMapping(typeName = "ABC")
. There is still aGraphQLWiring
class that can be extended, but it seems impossible to exclude the data loader. I've tried as follows, but theController
andDataFetcher
methods are still called.Is there any way to achieve the same behaviour as was possible in 1.x? If not, it would be great if it could be added.