Skip to content

Custom Get URI Template always enforces ID #8412

Description

@Dasc3er

API Platform version(s) affected: x.y.z

Description

When setting up a simple Get endpoint with a different path param from ID (ID not available), the system assumes the first path param is ID on the UI if the resource has a ID field.

The issue does not happen if there is not a ID field.

It is unclear if the issue is on the OpenAPI UI proxy here or something else more in depth.

How to reproduce

#[ApiResource(
    shortName: 'Test',
    operations: [
        new Get(
            uriTemplate: '/test/{dir}',
        ),new Get(
            uriTemplate: '/test/{id}/{dir}',
        ),
    ]
)]
class TestResource
{
    public int $id;
}

#[ApiResource(
    shortName: 'Test2',
    operations: [
        new Get(
            uriTemplate: '/test2/{dir}',
        ),new Get(
            uriTemplate: '/test2/{id}/{dir}',
        ),
    ]
)]
class Test2Resource
{
    public int $not_id;
}
Image Image Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions