Skip to content

[GraphQL] Output class not respected / working for custom mutations #2754

Open
@lukasluecke

Description

@lukasluecke

I have the following annotation in my entity:

 * @ApiResource(
 *      graphql={
 *         "custom"={
 *             "args"={},
 *             "mutation"=MyCustomResolver::class,
 *             "output"=MyCustomOutput::class
 *         }
 *     }
 * )

class DummyEntity {
    [...]
}

This should result in a GraphQL mutation customDummyEntity with empty args and a result of MyCustomOutput.

First issue which is caused by #2612 is that even though output is set the result gets wrapped in SchemaBuilder and the output class is lost during this.

After setting $useWrappedType to false:
"message": "Cannot query field \"customField\" on type \"myCustomOperationPayload.customField\".",

After setting $wrapData to false:
Custom mutation resolver \"App\\Resolver\\MyCustomResolver\" has to return an item of class DummyEntity but returned an item of class MyCustomOutput.

After disabling that check:
"Cannot return null for non-nullable field myCustomOperationPayload.customField."

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions