Project

General

Profile

Feature #32214

Register query fields with custom resolvers

Added by Ondřej Pražák over 1 year ago. Updated 9 months ago.

Status:
Closed
Priority:
Normal
Category:
API
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:

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

Revision ba49a334 (diff)
Added by Ondřej Pražák 10 months ago

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

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

#5 Updated by Amit Upadhye 9 months ago

  • Category set to API

Also available in: Atom PDF