OutputResolvable

public protocol OutputResolvable : Resolvable

Attention

this is a low level API. Do not use this directly unless you know what you’re doing.

OutputResolvable

Output Resolvable describes an Object that can be used as an Output in GraphQL.

It means that for a method or property to be available in GraphQL, all the output has to conform to OutputResolvable

Output Resolvable Types are:

  • Scalars
  • Enums
  • Objects
  • Root Types
  • Optionals, Futures and Arrays through Conditional Conformance
  • Additional Arguments you will need when resolving the value in resolve(source:arguments:context:eventLoop).

    Declaration

    Swift

    static var additionalArguments: [String : InputResolvable.Type] { get }
  • Warning

    never call this method directly. Always use: context.reference(for: ...)

    Creates a Reference to the GraphQL Type

    Declaration

    Swift

    static func reference(using context: inout Resolution.Context) throws -> GraphQLOutputType

    Parameters

    context

    Resolution Context where all the type relationships are stored. Use the context to resolve nested types.

    Return Value

    A GraphQLOutputType describing the Reference to the Type..

  • Warning

    never call this method directly. Always use: context.resolve(type: ...)

    Creates the Definition that will be used from GraphQL

    Declaration

    Swift

    static func resolve(using context: inout Resolution.Context) throws -> GraphQLOutputType

    Parameters

    context

    Resolution Context where all the type relationships are stored. Use the context to resolve nested types.

    Return Value

    A GraphQLOutputType describing this Type..

  • Resolves the value that can be outputed to GraphQL

    Declaration

    Swift

    func resolve(source: Any, arguments: [String : Map], context: MutableContext, eventLoop: EventLoopGroup) throws -> Output

    Parameters

    source

    Parent of this type

    arguments

    Arguments given to the parent field

    context

    Context, containing additional runtime data about the resuts. You may also include additional information here for other nested types to use

    eventLoop

    Event Loop Group that can be used for creating futures

    Return Value

    A Future with a value that can be evaluated by GraphQL.