Skip to content

fix(metadata): allow GraphQL operations in parameter attributes on properties - #8621

Open
Maxcastel wants to merge 1 commit into
api-platform:5.0from
Maxcastel:fix/allow-graphql-operations-for-parameter-attributes-on-properties
Open

Maxcastel wants to merge 1 commit into
api-platform:5.0from
Maxcastel:fix/allow-graphql-operations-for-parameter-attributes-on-properties

Conversation

@Maxcastel

Copy link
Copy Markdown
Contributor
Q A
Branch? 5.0
Tickets Follow-up to #8552
License MIT
Doc PR api-platform/docs#...

#8552 throws when a parameter attribute on a property is restricted to an operation the resource does not declare, but it only looks at operations: restricting it to a GraphQL operation declared in graphQlOperations always throws:

Before

#[ApiResource(
    operations: [
        new GetCollection(),
    ],
    graphQlOperations: [
        new QueryCollection(),
    ]
)]
class Book
{
    #[QueryParameter(key: 'search', operations: [new QueryCollection()])]
    public string $name = '';
}

RuntimeException: Parameter attribute on property "name" is restricted to the operation "ApiPlatform\Metadata\GraphQl\QueryCollection" which is not declared on the resource "App\Entity\Book".

After

The search parameter is added to the QueryCollection GraphQL operation only (not to the HTTP GetCollection). An operation declared in neither operations nor graphQlOperations still throws.

@Maxcastel Maxcastel changed the title fix(metadata): allow GraphQL operations in parameter attributes on pr… fix(metadata): allow GraphQL operations in parameter attributes on properties Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant