Comments (3)
Hi @WardVandevoort,
This bundle decorates the OpenApiFactory from API Platform (api_platform.openapi.factory
) to document the its routes.
For your use-case, I advise you to decorate it too and add your own behavior: https://github.com/coopTilleuls/CoopTilleulsForgotPasswordBundle/blob/main/src/Bridge/ApiPlatform/OpenApi/AbstractOpenApiFactory.php
from cooptilleulsforgotpasswordbundle.
Closing as it's not a bug nor related to this bundle, and a solution has been found.
from cooptilleulsforgotpasswordbundle.
@vincentchalamon That's what I did, yet it is still showing the original documentation. How am I supposed to make my decorator overwrite the package's decorator?
public function __construct(private OpenApiFactoryInterface $decorated)
{
}
/**
* @psalm-suppress PossiblyNullReference
*/
public function __invoke(array $context = []): OpenApi
{
$openApi = ($this->decorated)($context);
$schemas = $openApi->getComponents()->getSchemas();
$schemas['ForgotPassword:reset'] = new \ArrayObject([
'type' => 'object',
'properties' => [
'password' => [
'type' => 'string',
'example' => 'password',
],
'confirm_password' => [
'type' => 'string',
'example' => 'password',
],
],
]);
$pathItem = new Model\PathItem(
ref: 'ForgotPassword',
post: new Model\Operation(
parameters: [new Model\Parameter(
name: 'tokenValue',
in: 'path',
description: 'Token value',
required: true,
)],
operationId: 'postForgotPasswordToken',
tags: ['Forgot password'],
responses: [
204 => [
'description' => 'Email address format valid, no matter if user exists or not',
],
400 => [
'description' => 'Missing password parameter',
],
404 => [
'description' => 'Token not found',
],
],
summary: 'Validates token test',
requestBody: new Model\RequestBody(
description: 'Reset password',
content: new \ArrayObject([
'application/json' => [
'schema' => [
'$ref' => '#/components/schemas/ForgotPassword:reset',
],
],
]),
)
)
);
$openApi->getPaths()->addPath('/api/users/password-reset/{tokenValue}', $pathItem);
return $openApi;
}
from cooptilleulsforgotpasswordbundle.
Related Issues (20)
- Issue with naming of token and tokenValue parameter HOT 6
- Follow Symfony Bundles best practices
- Release 1.4.5 has BC breaks HOT 3
- Dispatches an event when the user is not found
- overriding post forgot password doesn't work HOT 1
- Not work with PHP 8.2 HOT 2
- Method setUser() is not compatible with method HOT 1
- [Documentation] Wrong call from Kernel Request Event HOT 1
- How can we perform password validation? HOT 2
- Getting a 204 without a response or any other logs HOT 3
- Minutes of expiry date fixed to numeric representation of the current month HOT 1
- trailing slash in route
- Feature Request: Customizable Token Generation HOT 1
- How to Disable forgot-password Routes in ReDoc Documentation Only? HOT 5
- Cannot autowire service "App\EventSubscriber\ForgotPasswordEventSubscriber": argument "$userManager" HOT 2
- Encode password HOT 1
- Symfony 6 compatibility HOT 2
- Hardcoded paths HOT 2
- API Platform 3.0 compatibility
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cooptilleulsforgotpasswordbundle.