Exemplo n.º 1
0
        private static async Task <object> CompleteUnionValueAsync(
            IExecutorContext executorContext,
            ObjectType actualType,
            IReadOnlyCollection <GraphQLFieldSelection> fields,
            object value,
            NodePath path,
            UnionType unionType)
        {
            if (!unionType.IsPossible(actualType))
            {
                throw new CompleteValueException(
                          "Cannot complete value as union. " +
                          $"Actual type {actualType.Name} is not possible for {unionType.Name}",
                          path,
                          fields.First());
            }

            var subSelectionSet = SelectionSets.MergeSelectionSets(fields);
            var data            = await SelectionSets.ExecuteSelectionSetAsync(
                executorContext,
                subSelectionSet,
                actualType,
                value,
                path).ConfigureAwait(false);

            return(data);
        }
Exemplo n.º 2
0
        private static async Task <object> CompleteInterfaceValueAsync(
            IExecutorContext executorContext,
            ObjectType actualType,
            IReadOnlyCollection <GraphQLFieldSelection> fields,
            object value,
            NodePath path,
            InterfaceType interfaceType)
        {
            if (!actualType.Implements(interfaceType))
            {
                throw new CompleteValueException(
                          "Cannot complete value as interface. " +
                          $"Actual type {actualType.Name} does not implement {interfaceType.Name}",
                          path,
                          fields.First());
            }

            var subSelectionSet = SelectionSets.MergeSelectionSets(fields);
            var data            = await SelectionSets.ExecuteSelectionSetAsync(
                executorContext,
                subSelectionSet,
                actualType,
                value,
                path).ConfigureAwait(false);

            return(data);
        }
Exemplo n.º 3
0
        private static async Task <object> CompleteObjectValueAsync(IExecutorContext executorContext, List <GraphQLFieldSelection> fields, object value,
                                                                    Dictionary <string, object> coercedVariableValues, NodePath path, ObjectType fieldObjectType)
        {
            var subSelectionSet = SelectionSets.MergeSelectionSets(fields);
            var data            = await SelectionSets.ExecuteSelectionSetAsync(
                executorContext,
                subSelectionSet,
                fieldObjectType,
                value,
                coercedVariableValues,
                path).ConfigureAwait(false);

            return(data);
        }
Exemplo n.º 4
0
        private static async Task <object> CompleteObjectValueAsync(
            IExecutorContext executorContext,
            IReadOnlyCollection <GraphQLFieldSelection> fields,
            object value,
            NodePath path,
            ObjectType fieldObjectType)
        {
            var subSelectionSet = SelectionSets.MergeSelectionSets(fields);
            var data            = await SelectionSets.ExecuteSelectionSetAsync(
                executorContext,
                subSelectionSet,
                fieldObjectType,
                value,
                path).ConfigureAwait(false);

            return(data);
        }