nelmio / NelmioApiDocBundle

Generates documentation for your REST API from annotations
MIT License
2.22k stars 832 forks source link

The "Nelmio\ApiDocBundle\Processor\MapRequestPayloadProcessor" class implements "OpenApi\Processors\ProcessorInterface" that is deprecated[Bug]: #2324

Closed habib-halaoui closed 1 month ago

habib-halaoui commented 2 months ago

Version

master

Description

Hi, I have this deprecated message

The "Nelmio\ApiDocBundle\Processor\MapRequestPayloadProcessor" class implements "OpenApi\Processors\ProcessorInterface" that is deprecated. How i can solve It please ?

JSON OpenApi

JSON OpenApi ```json Replace this text with your JSON (`bin/console nelmio:apidoc:dump`) ```

Additional context

No response

xammmue commented 2 months ago

I think you can't do anything about it yourself (other then propose some code changes in nelmio of course). Seems to be related to this other issue from one month ago: https://github.com/nelmio/NelmioApiDocBundle/issues/2295

As it is just a deprecation message you shouldn't need to worry about it yet

DjordyKoert commented 2 months ago

A few weeks ago I tried to fix this but it seems to be more complex than it seems to fix this deprecation. I couldn't really figure out how to replace this with the new methods provided by swagger-php.

A PR is always welcome :)

ThibaultPelloquin commented 1 month ago

@DjordyKoert Hi!

I don't understand why this is a problem?

The ProcessorInterface was empty so it was not usefull, but it doesn't force you to use the Pipeline...

For me you can simply remove this from your three Processors :

# remove this
use OpenApi\Processors\ProcessorInterface

# remove the implements
final class (...)  implements ProcessorInterface

And in your ApiDocGenerator :

# remove this
use OpenApi\Processors\ProcessorInterface

# keep only array
* @return array<ProcessorInterface|callable> The array of processors

Or you can make your own ProcessorInterface, in the Processor directory with this in it :

public function __invoke(Analysis $analysis): void

and modify the 4 use listed on top ?

Have a nice day!

DjordyKoert commented 1 month ago

Yup that's my bad. I looked too deep into it and wanted to also fully remove all deprecated method calls at the same time (which is what I was struggling with).

Fix ready in https://github.com/nelmio/NelmioApiDocBundle/pull/2332