Smile-SA / magento2-module-retailer

14 stars 29 forks source link

Invalid docblocks in API models (types are not FQCN) #44

Closed xi-ao closed 2 weeks ago

xi-ao commented 2 months ago

Hi,

Attempting to get the list of the services through the integrated Swagger returns an error once the module is installed. It appears that the classes/interfaces in Api/ do not follow the rules regarding fully qualified class names in the docblocks.

See https://developer.adobe.com/commerce/php/development/components/web-api/services/#service-interface-requirements

The following patch fixes this.

Index: magento/vendor/smile/module-retailer/Api/RetailerRepositoryInterface.php
<+>UTF-8
===================================================================
diff --git a/vendor/smile/module-retailer/Api/RetailerRepositoryInterface.php b/vendor/smile/module-retailer/Api/RetailerRepositoryInterface.php
--- a/vendor/smile/module-retailer/Api/RetailerRepositoryInterface.php
+++ b/vendor/smile/module-retailer/Api/RetailerRepositoryInterface.php  (date 1718632758499)
@@ -17,18 +17,18 @@
     /**
      * Create retailer service
      *
-     * @param RetailerInterface|SellerInterface $retailer The retailer
-     * @return RetailerInterface|SellerInterface
+     * @param \Smile\Retailer\Api\Data\RetailerInterface|\Smile\Seller\Api\Data\SellerInterface $retailer The retailer
+     * @return \Smile\Retailer\Api\Data\RetailerInterface|\Smile\Seller\Api\Data\SellerInterface
      * @throws \Magento\Framework\Exception\CouldNotSaveException
      */
-    public function save(RetailerInterface|SellerInterface $retailer);
+    public function save(\Smile\Retailer\Api\Data\RetailerInterface|\Smile\Seller\Api\Data\SellerInterface $retailer);

     /**
      * Get info about retailer by retailer id
      *
      * @param int $retailerId The retailer Id
      * @param ?int  $storeId    The store Id
-     * @return RetailerInterface|SellerInterface
+     * @return \Smile\Retailer\Api\Data\RetailerInterface|\Smile\Seller\Api\Data\SellerInterface
      * @throws \Magento\Framework\Exception\NoSuchEntityException
      */
     public function get(int $retailerId, ?int $storeId = null);
@@ -38,7 +38,7 @@
      *
      * @param string $retailerCode The retailer Code
      * @param ?int $storeId        The store Id
-     * @return RetailerInterface|SellerInterface
+     * @return \Smile\Retailer\Api\Data\RetailerInterface|\Smile\Seller\Api\Data\SellerInterface
      * @throws \Magento\Framework\Exception\NoSuchEntityException
      */
     public function getByCode(string $retailerCode, ?int $storeId = null);
@@ -46,7 +46,7 @@
     /**
      * Get relation list
      *
-     * @param SearchCriteriaInterface $criteria Search criterai for collection
+     * @param \Magento\Framework\Api\SearchCriteriaInterface $criteria Search criterai for collection
      * @return RetailerSearchResultsInterface
      */
     public function getList(SearchCriteriaInterface $criteria): RetailerSearchResultsInterface;
@@ -54,13 +54,13 @@
     /**
      * Delete retailer by identifier
      *
-     * @param RetailerInterface|SellerInterface $retailer retailer which will deleted
+     * @param \Smile\Retailer\Api\Data\RetailerInterface|\Smile\Seller\Api\Data\SellerInterface $retailer retailer which will deleted
      * @return bool Will returned True if deleted
      * @throws \Magento\Framework\Exception\InputException
      * @throws \Magento\Framework\Exception\StateException
      * @throws \Magento\Framework\Exception\NoSuchEntityException
      */
-    public function delete(RetailerInterface|SellerInterface $retailer): bool;
+    public function delete(RetailerInterface|\Smile\Seller\Api\Data\SellerInterface $retailer): bool;

     /**
      * Delete retailer by identifier