Core: Support short UUID in Ramsey bridge

Created on 6 Sep 2018  路  6Comments  路  Source: api-platform/core

We could add rudimentary support in the Ramsey UUID normalizer for the short UUID variant: https://packagist.org/packages/pascaldevink/shortuuid

Most helpful comment

It's really easy to add this in one's own project no? Not sure we need to add this to core. That said, if you read this please add :+1: on the issue if there's enough people we may consider it :).

All 6 comments

It's really easy to add this in one's own project no? Not sure we need to add this to core. That said, if you read this please add :+1: on the issue if there's enough people we may consider it :).

we can't implement this, because this test not working :

    public function testFailDenormalizeUuid()
    {
        $this->expectException(\ApiPlatform\Core\Exception\InvalidIdentifierException::class);

        $uuid = 'notanuuid';
        $normalizer = new ShortUuidNormalizer();
        $this->assertTrue($normalizer->supportsDenormalization($uuid, ShortUuid::class));
        $normalizer->denormalize($uuid, ShortUuid::class);

    }

Would love to take that one. Any idea how this should be configured? I'm guessing it should be an opt-in configuration option?

We can't implement this yet because an invalid uuid doesn't throw on the upstream library. see related links, mb you can try to patch there first

Oh good to know, I'll see what I can do. Thanks @soyuka

Was this page helpful?
0 / 5 - 0 ratings