coopTilleuls / CoopTilleulsForgotPasswordBundle

Provides a "forgot password" complete feature for your API through a Symfony bundle
MIT License
79 stars 25 forks source link

Hardcoded paths #93

Closed Cruiser13 closed 2 years ago

Cruiser13 commented 2 years ago

Describe the bug Both Bridge/ApiPlatform/OpenApi/OpenApiFactory.php and Bridge/ApiPlatform/Serializer/DocumentationNormalizer.php use hardcoded paths to /forgot-password/and /forgot-password/{token}

To Reproduce Use a routing like this:

coop_tilleuls_forgot_password:
  resource: "@CoopTilleulsForgotPasswordBundle/Resources/config/routing.xml"
  prefix:   /api/forgot_password

Expected behavior The bundle works at /api/forgot_password

Actual behavior The routing is set to /api/forgot_password but the docs are still leading to /forgot-password/and /forgot-password/{token} While it's possible to set the proper routes using OpenApi in application it seems to be not possible to remove the routes set by the bundle.

Proposed fix Use prefix instead of hardcoded route in Bridge/ApiPlatform/OpenApi/OpenApiFactory.php and Bridge/ApiPlatform/Serializer/DocumentationNormalizer.php

vincentchalamon commented 2 years ago

Hi @Cruiser13,

A fix has been published, can you try it on your project please? I have some concerns about performances while injecting the router on services.

To install this pre-release version:

composer require tilleuls/forgot-password-bundle:dev-main
Cruiser13 commented 2 years ago

@vincentchalamon thank you, this works nicely! We can not measure any performance differences on the ForgotPassword endpoint.