I am currently working with a NelmioApiDocBundle, which I am not very familiar with yet. The API I am writing should provide a route for changing the password of a specific user. The documentation should indicate that changing the password requires both old and new. Since I did not find an explanation of the difference between Requirementsand Parameters, I assume that the former is used for route data, and the latter is used for the API call itself.
The first attempt to archive such documentation was to implement a simple model that the JMSSerializerBundle automatically converts:
class ChangePasswordParam
{
protected $oldPassword;
protected $newPassword;
}
The controller accepts an API call through this action method:
public function changePasswordAction($username, ChangePasswordParam $passwordParam)
{
}
, username , old_password new_password . , Symfony :
class ChangePasswordParam
{
protected $oldPassword;
protected $newPassword;
}
, , , :

, ? @SerializedName("old_password") . , .
, , . ChangePasswordParam :
class ChangePasswordParam extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('old_password', 'text');
$builder->add('new_password', 'text');
}
public function getName()
{
return 'change_password';
}
}
:

"old_password" "new_password", , .