Api-platform: Problem with OpenApi api-platform 2.6

Created on 14 Feb 2021  路  3Comments  路  Source: api-platform/api-platform

Hi,

I'm using api-platform 2.5 with old version of the Swagger. I have some custom route defined with this doc : https://api-platform.com/docs/v2.5/core/jwt/ . Since I upgrade to 2.6 version of Api-platform I need to change my route to OpenApi.

  • Possible to keep the old version and use SwaggerDecorator or I'm oblige to switch to new version with OpenApi ?
  • I don't arrive to reproduce properly example in https://api-platform.com/docs/core/jwt/ without errors, I think it's my php 7.4 version (not using php 8), someone have an example in php 7.4 ?

Thanks for your help !

Most helpful comment

The example use the new PHP8 syntax : https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments
Of course, every body is already in PHP8 :-( !
I try to do a working example but it is awful. Is it possible to add the setters ? We can in this case use ->setPost(), ->setGet() and al to define cleanly the content ?
We can use the withPost(), but it return a clone of the PathItem object. If we use the setters, we can return $this, and chain the definitions

Here a working version :
JwtDecorator.php.zip

All 3 comments

The example use the new PHP8 syntax : https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments
Of course, every body is already in PHP8 :-( !
I try to do a working example but it is awful. Is it possible to add the setters ? We can in this case use ->setPost(), ->setGet() and al to define cleanly the content ?
We can use the withPost(), but it return a clone of the PathItem object. If we use the setters, we can return $this, and chain the definitions

Here a working version :
JwtDecorator.php.zip

@dominiquefournier Thanks a lot ! Its working perfectly

@dominiquefournier Thanks !

Was this page helpful?
0 / 5 - 0 ratings