Skip to content

Commit

Permalink
api: fix deprecation 'Since api-platform/core 3.1: The "openapiContex…
Browse files Browse the repository at this point in the history
…t" option is deprecated, use "openapi" instead.'
  • Loading branch information
BacLuc committed Dec 11, 2023
1 parent 2eaffdc commit b274c84
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
10 changes: 5 additions & 5 deletions api/src/DTO/Invitation.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Patch;
use ApiPlatform\OpenApi\Model\Operation as OpenApiOperation;
use App\State\InvitationAcceptProcessor;
use App\State\InvitationProvider;
use App\State\InvitationRejectProcessor;
Expand All @@ -23,7 +24,7 @@
provider: InvitationProvider::class,
uriTemplate: '/invitations/{inviteKey}/find{._format}', // TO DISCUSS: Wouldn't '/{inviteKey}{._format}' be more REST-like
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
openapiContext: ['description' => 'Use myInviteKey to find an invitation in the dev environment.']
openapi: new OpenApiOperation(description: 'Use myInviteKey to find an invitation in the dev environment.')
),
new Patch(
provider: InvitationProvider::class,
Expand All @@ -33,7 +34,7 @@
uriTemplate: '/invitations/{inviteKey}/'.self::ACCEPT.'{._format}',
denormalizationContext: ['groups' => ['write']],
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
openapiContext: ['summary' => 'Accept an Invitation.', 'description' => 'Use myInviteKey2 to accept an invitation in dev environment.'],
openapi: new OpenApiOperation(summary: 'Accept an Invitation.', description: 'Use myInviteKey2 to accept an invitation in dev environment.'),
validationContext: ['groups' => ['Default', 'accept']]
),
new Patch(
Expand All @@ -43,13 +44,12 @@
uriTemplate: '/invitations/{inviteKey}/'.self::REJECT.'{._format}',
denormalizationContext: ['groups' => ['write']],
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
openapiContext: ['summary' => 'Reject an Invitation.', 'description' => 'Use myInviteKey to reject an invitation in dev environment.']
openapi: new OpenApiOperation(summary: 'Reject an Invitation.', description: 'Use myInviteKey to reject an invitation in dev environment.')
),
new GetCollection(
provider: InvitationProvider::class,
security: 'false',
openapi: false,
openapiContext: ['description' => 'Not implemented. Only needed that we can show this endpoint in /index.jsonhal.']
openapi: false
),
],
)]
Expand Down
3 changes: 2 additions & 1 deletion api/src/DTO/ResetPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use ApiPlatform\OpenApi\Model\Operation as OpenApiOperation;
use App\InputFilter;
use App\State\ResetPasswordCreateProcessor;
use App\State\ResetPasswordProvider;
Expand Down Expand Up @@ -36,7 +37,7 @@
output: false,
denormalizationContext: ['groups' => ['create']],
normalizationContext: ['groups' => ['read']],
openapiContext: ['summary' => 'Request Password-Reset-Mail', 'description' => 'Password-Reset-Link will be sent to the given email']
openapi: new OpenApiOperation(summary: 'Request Password-Reset-Mail', description: 'Password-Reset-Link will be sent to the given email')
),
],
routePrefix: '/auth'
Expand Down
5 changes: 3 additions & 2 deletions api/src/Entity/CampCollaboration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use ApiPlatform\OpenApi\Model\Operation as OpenApiOperation;
use App\InputFilter;
use App\Repository\CampCollaborationRepository;
use App\State\CampCollaborationCreateProcessor;
Expand Down Expand Up @@ -50,7 +51,7 @@
security: '(is_authenticated() && user === object.user) or is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)',
uriTemplate: 'camp_collaborations/{id}/'.self::RESEND_INVITATION,
denormalizationContext: ['groups' => ['resend_invitation']],
openapiContext: ['summary' => 'Send the invitation email for this CampCollaboration again. Only possible, if the status is already invited.'],
openapi: new OpenApiOperation(summary: 'Send the invitation email for this CampCollaboration again. Only possible, if the status is already invited.'),
validationContext: ['groups' => ['Default', 'resend_invitation']]
),
new GetCollection(
Expand All @@ -61,7 +62,7 @@
processor: CampCollaborationCreateProcessor::class,
denormalizationContext: ['groups' => ['write', 'create']],
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
openapiContext: ['description' => 'Also sends an invitation email to the inviteEmail address, if specified.'],
openapi: new OpenApiOperation(description: 'Also sends an invitation email to the inviteEmail address, if specified.'),
securityPostDenormalize: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)'
),
],
Expand Down

0 comments on commit b274c84

Please sign in to comment.