Skip to content

[GraphQL] Embedded resources does not work for mutations #3258

@Fgruntjes

Description

@Fgruntjes

API Platform version(s) affected: 2.5.1

Description
When resources are defined in yaml instead of Doctrine GraphQL will not show them as embedded resources for mutations.

The schema definition

App\Entity\Book:
    collectionOperations: ~
    itemOperations: ~
    attributes:
        normalization_context:
            groups: ['Book']
        denormalization_context:
            groups: ['Book']
    properties:
        id:
            readonly: true
        title:
            required: true
        pages:
            subresource:
                resourceClass: 'App\Entity\Page'
                collection: true

App\Entity\Page:
    collectionOperations: ['get']
    itemOperations: ['get']
    attributes:
        normalization_context:
            groups: ['Book']
        denormalization_context:
            groups: ['Book']
    properties:
        id:
            readonly: true
        content:
            required: true

And serialization config

App\Entity\Book:
    attributes:
        id:
            groups: ['Book']
        title:
            groups: ['Book']
        pages:
            groups: ['Book']

App\Entity\Page:
    attributes:
        id:
            groups: ['Book']
        content:
            groups: ['Book']

Will create the following createBookInput object in graphql
image

How to reproduce

Additional Context
Similar to these issues but @alanpoulain suggested that they are likely not the same.

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