api-platform / core

The server component of API Platform: hypermedia and GraphQL APIs in minutes
https://api-platform.com
MIT License
2.38k stars 846 forks source link

Unable to generate an IRI for the item of type App\ApiResource\*** with an UriTemplate #6413

Closed mpiot closed 3 weeks ago

mpiot commented 3 weeks ago

API Platform version(s) affected: 3.3.*

Description
I have an ApiResource stored in App\ApiResource with an API attribute:

#[Get(
    uriTemplate: '/users/{id}/groups',
    openapi: new Operation(tags: ['User']),
    normalizationContext: ['groups' => [self::API_READ], 'iri_only' => true],
    security: 'is_granted("REPLE_API_SOMETHING")',
    provider: UserGroupsProvider::class
)]
final class UserGroups
{
    public const string API_READ = 'user_group:read';

    // ...
}

If I add a simple:

#[Get]
// ...

The bug disapeear and the docs add an entry for: /api/user_groups/{id}. But the goal here is to have the user identifier then use this ApiResource like a Subresource to get a list of groups.

In ApiPlatform previous 3.3 version, it works well, bu since this version this bug appeared.

soyuka commented 3 weeks ago

Not sure what's going on can you add more informations? contact me on slack if you want