api-platform / core

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

Generated OpenApi Docs are different depending if metadata cache exists or not #6731

Open ostrolucky opened 1 month ago

ostrolucky commented 1 month ago

API Platform version(s) affected: 3.4.3

Description
I was banging my head against the wall trying to figure out why locally running test passes, but on CI it fails. Then I found it fails locally as well when my cache needs to be generated. Finally, I compared before & after running tests and only significant difference is that var/cache/test/pools have now new metadata cache files

Here is the diff

image

Example file

root@c49b853ae106:/srv/api# cat var/cache/test/pools/system/8s0Py00TIs/+/A/5k95jvAy2d87QtUsL8OQ
<?php //property_name_collection_a5b6522759cfc7a5bb8956432b324254

return [PHP_INT_MAX, static fn () => \Symfony\Component\VarExporter\Internal\Hydrator::hydrate(
    $o = [
        clone (\Symfony\Component\VarExporter\Internal\Registry::$prototypes['ApiPlatform\\Metadata\\Property\\PropertyNameCollection'] ?? \Symfony\Component\VarExporter\Internal\Registry::p('ApiPlatform\\Metadata\\Property\\PropertyNameCollection')),
    ],
    null,
    [
        'ApiPlatform\\Metadata\\Property\\PropertyNameCollection' => [
            'properties' => [
                [
                    'id',
                ],
            ],
        ],
    ],
    $o[0],
    []
)];
soyuka commented 1 month ago

Not sure why OpenAPIFactory doesn't generate the full cache though