Symfony 5 route named parameter constraint validator

I have an API route as follows:

authors{identifier}

I am looking to add a custom validator to make sure that the consumer of this endpoint is the same as that in the identifier (as identified by the token in the auth headers)

As this i a named route parameter I was hoping I could create a custom validator to verify that value, but I can’t see which I need to use?

I am defining my validators in yaml format

Fields only seems to work on query string parameters, attributes isn’t supported so how can I do this?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *