Imports https://github.com/api-platform/core/pull/2899 and fixes https://github.com/nelmio/NelmioApiDocBundle/issues/1517