By default ApiPlatform (opens new window), requires an ApiResource to have at least one property as it uses them to:
- generate the documentation
- serialise/de-serialise the ApiResource from the request and to the response
This can be an issue in the case you want to create a simple endpoint with no request payload. This package provides a feature to allow you to create an ApiResource with no request payload.
# No Properties ApiResource
To create a simple API endpoint with no request payload but still beneficiate of the auto generated documentation and
ApiPlatform features such as DataPersister, create an ApiResource that implements the EonX\EasyCore\Bridge\Symfony\ApiPlatform\Interfaces
.
// src/Api/Resource/EmailsSendResource.php
namespace App\Api\Resource;
use ApiPlatform\Core\Annotation\ApiResource;
use EonX\EasyCore\Bridge\Symfony\ApiPlatform\Interfaces\NoPropertiesApiResourceInterface;
/**
* @ApiResource()
*/
final class EmailsSendResource implements NoPropertiesApiResourceInterface
{
// No properties!
}