Glue Backend Request Validation

LukasB
LukasB lukas.bruecklmeier@unic.com Posts: 22 ✨ - Novice

Hello everybody,

is there a way to validate a request to the glue backend api in the same way that is described for the storefront api here ?

https://docs.spryker.com/docs/dg/dev/glue-api/202404.0/glue-api-tutorials/validate-rest-request-format.html#install-the-coderestrequestvalidationcode-module?

Answers

  • LukasB
    LukasB lukas.bruecklmeier@unic.com Posts: 22 ✨ - Novice

    Thanks @profuel!

    I saw the ValidateRestRequestAttributesPlugin in the Storefront Glue yesterday and added it to the Backend Dependency Provider. After getting an error I though I ask here if there is an easier way without that much customization. But then it's clear to me what needs to be done - thanks!

  • jose.isasa
    jose.isasa Spryker Solution Partner Posts: 2 🧑🏻‍🚀 - Cadet

    @LukasB funny running into you again after searching the forum because of an issue that we both share :D

    We also stumbled upon the same guide in the documentation and figured it was unfortunately only for Storefront. Hence we are going custom as per @profuel indications too.

    My question is how custom have you needed to go?

    Unfortunately I cannot share the actual code but to keep it consistent and use the restRequestParameter attribute we seem in need to validate the request attributes within GlueRequestTransfer against the definition of the transfer in RestXXXXXRequestAttributesTransfer::$transferMetadata.

    Are you aware of any generic out of the box tool in Spryker we can use to validate the transfer? We feel in need to use Reflection and do it all ourselves which is unfortunate.

    @profuel to your knowledge, is there any plan for Spryker to improve this?

    Thank you both and BR.
    José

  • LukasB
    LukasB lukas.bruecklmeier@unic.com Posts: 22 ✨ - Novice

    Good to know, thanks for sharing @jose.isasa :)