We can modify GraphQLContribution with a method called get_resource_graphql_output_type_mixin. This method allows extensions to define additional fields that should be present on the Resource output object.
We will then compose the Resource output object from the class we have in core and from all of the extensions that want to add fields to it.
Proposal A: POC Compose a Resource sqlalchemy model and resolve the fields on the extensions
Proposal B: It is possible that this will require extensions to add stuff to the query context since these fields are not present natively in sqlalchemy they need to be calculated in custom resolvers. If that need arises, we can also add a get_context_loaders method to GraphQLContribution and we compose our context from the contributions of all extensions.
We can modify
GraphQLContributionwith a method calledget_resource_graphql_output_type_mixin. This method allows extensions to define additional fields that should be present on the Resource output object.We will then compose the Resource output object from the class we have in core and from all of the extensions that want to add fields to it.
Proposal A: POC Compose a Resource sqlalchemy model and resolve the fields on the extensions
Proposal B: It is possible that this will require extensions to add stuff to the query context since these fields are not present natively in sqlalchemy they need to be calculated in custom resolvers. If that need arises, we can also add a
get_context_loadersmethod toGraphQLContributionand we compose our context from the contributions of all extensions.