Feature #32214
Register query fields with custom resolvers
Pull request:
Fixed in Releases:
Found in Releases:
Description
We currently support registering queries from plugins for a single record or collection of records which works flawlessly for models. There might be cases when a developer would like to query data that is not backed by a model and needs more control over how the query is resolved, therefore it would be good if there was a way to register custom resolver with the field.
Associated revisions
History
#1
Updated by The Foreman Bot over 1 year ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/8415 added
#2
Updated by The Foreman Bot 11 months ago
- Pull request https://github.com/theforeman/foreman/pull/8794 added
#3
Updated by The Foreman Bot 10 months ago
- Fixed in Releases 3.1.0 added
#4
Updated by Ondřej Pražák 10 months ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman|ba49a334d5f2bd5ef237c513838a960be532c2f5.
#5
Updated by Amit Upadhye 9 months ago
- Category set to API
Fixes #32214 - Register query field with a resolver
Foreman::Plugin.register :foreman_plugin do
register_graphql_query_field :foo, '::Types::Foo', :field, { :resolver => ::Resolvers::Foos::Foo } # register with lambda instead of a string if type does not resolve to a contant
register_graphql_query_field :bars, -> () { [::Types::Bar] }, :field, { :resolver => ::Resolvers::Bars }
end