Skip to content

CatalogExportApi auto-generation #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Dec 10, 2020

Conversation

bricht
Copy link

@bricht bricht commented Nov 23, 2020

-Added a Setup/Recurring class to autogenerate the CatalogExportApi files upon se:up
-Removed the cliCommand
-Removed the manually added files from CatalogExportApi/Api/Data

Description (*)

Related Pull Requests

https://github.com/magento-commerce/commerce-data-export-ee/pull/3

Fixed Issues (if relevant)

  1. Fixes CatalogExportApi autogeneration catalog-storefront#430

Questions or comments

Code Review Checklist (*)

  • Story AC is completed
  • proposed changes correspond to Magento Technical Vision
  • new or changed code is covered with web-api/integration tests (if applicable)
  • no backward incompatible changes

 -Added a Setup/Recurring class to autogenerate the CatalogExportApi files upon se:up
 -Removed the cliCommand
 -Removed the manually added files from CatalogExportApi/Api/Data
@bricht
Copy link
Author

bricht commented Nov 23, 2020

@magento run all tests

 -Added php generator requirement
@bricht
Copy link
Author

bricht commented Nov 24, 2020

@magento run all tests

@bricht
Copy link
Author

bricht commented Nov 25, 2020

@magento run WebAPI Tests

 - Added comments to README describing DTO generation and necessity for nette/php-generator
@bricht
Copy link
Author

bricht commented Nov 25, 2020

@magento run all tests

@bricht
Copy link
Author

bricht commented Nov 26, 2020

@magento run WebAPI Tests

-docblock fix
-added return type
@bricht
Copy link
Author

bricht commented Nov 26, 2020

@magento run all tests

@slavvka
Copy link
Member

slavvka commented Nov 30, 2020

@magento run WebAPI Tests

@RuslanKostiv1
Copy link
Contributor

Build fails while installation @bricht

11:22:59 [testsuitegroup0] [Progress: 369 / 1331]
11:22:59 [testsuitegroup0] Module 'Magento_CatalogExport':
11:22:59 [testsuitegroup0] [Progress: 370 / 1331]
11:22:59 [testsuitegroup0] Module 'Magento_CatalogExportApi':
11:22:59 [testsuitegroup0] Running schema recurring...
11:22:59 [testsuitegroup0] In Recurring.php line 82:
11:22:59 [testsuitegroup0] 
11:22:59 [testsuitegroup0]   [RuntimeException]
11:22:59 [testsuitegroup0]   Could not generate ExportApi DTO's Error: Class 'Nette\PhpGenerator\PhpFile
11:22:59 [testsuitegroup0]   ' not found in /var/www/html/app/code/Magento/CatalogExportApi/Setup/Recurr
11:22:59 [testsuitegroup0]   ing.php:204
11:22:59 [testsuitegroup0]   Stack trace:
11:22:59 [testsuitegroup0]   #0 /var/www/html/app/code/Magento/CatalogExportApi/Setup/Recurring.php(80):
11:22:59 [testsuitegroup0]    Magento\CatalogExportApi\Setup\Recurring->generateFiles()
11:22:59 [testsuitegroup0]   #1 /var/www/html/setup/src/Magento/Setup/Model/Installer.php(1117): Magento
11:22:59 [testsuitegroup0]   \CatalogExportApi\Setup\Recurring->install()
11:22:59 [testsuitegroup0]   #2 /var/www/html/setup/src/Magento/Setup/Model/Installer.php(895): Magento\
11:22:59 [testsuitegroup0]   Setup\Model\Installer->handleDBSchemaData()
11:22:59 [testsuitegroup0]   #3 [internal function]: Magento\Setup\Model\Installer->installSchema()
11:22:59 [testsuitegroup0]   #4 /var/www/html/setup/src/Magento/Setup/Model/Installer.php(389): call_use
11:22:59 [testsuitegroup0]   r_func_array()
11:22:59 [testsuitegroup0]   #5 /var/www/html/setup/src/Magento/Setup/Console/Command/InstallCommand.php
11:22:59 [testsuitegroup0]   (231): Magento\Setup\Model\Installer->install()
11:22:59 [testsuitegroup0]   #6 /var/www/html/vendor/symfony/console/Command/Command.php(255): Magento\S
11:22:59 [testsuitegroup0]   etup\Console\Command\InstallCommand->execute()
11:22:59 [testsuitegroup0]   #7 /var/www/html/vendor/symfony/console/Application.php(1000): Symfony\Comp
11:22:59 [testsuitegroup0]   onent\Console\Command\Command->run()
11:22:59 [testsuitegroup0]   #8 /var/www/html/vendor/symfony/console/Application.php(271): Symfony\Compo
11:22:59 [testsuitegroup0]   nent\Console\Application->doRunCommand()
11:22:59 [testsuitegroup0]   #9 /var/www/html/lib/internal/Magento/Framework/Console/Cli.php(115): Symfo
11:22:59 [testsuitegroup0]   ny\Component\Console\Application->doRun()
11:22:59 [testsuitegroup0]   #10 /var/www/html/vendor/symfony/console/Application.php(147): Magento\Fram
11:22:59 [testsuitegroup0]   ework\Console\Cli->doRun()
11:22:59 [testsuitegroup0]   #11 /var/www/html/bin/magento(23): Symfony\Component\Console\Application->r
11:22:59 [testsuitegroup0]   un()
11:22:59 [testsuitegroup0]   #12 {main}

Copy link
Contributor

@RuslanKostiv1 RuslanKostiv1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please take a look into build logs

@mslabko
Copy link
Member

mslabko commented Dec 1, 2020

@magento run WebAPI Tests

1 similar comment
@mslabko
Copy link
Member

mslabko commented Dec 1, 2020

@magento run WebAPI Tests

@bricht
Copy link
Author

bricht commented Dec 2, 2020

@magento run all tests

@bricht
Copy link
Author

bricht commented Dec 2, 2020

@magento run WebAPI Tests

*/
protected function execute(InputInterface $input, OutputInterface $output): ?int
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context): void
Copy link
Member

@mslabko mslabko Dec 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, create a separate class with "generation" logic - so we can use it inside Recurring/di compile ...

@le0n4ik
Copy link
Contributor

le0n4ik commented Dec 2, 2020

You can use following plugin to intercept the GenerateApplicationCode operation:

Index: app/code/Magento/CatalogExport/Plugin/GenerateApplicationCode.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/code/Magento/CatalogExport/Plugin/GenerateApplicationCode.php	(date 1606938749913)
+++ app/code/Magento/CatalogExport/Plugin/GenerateApplicationCode.php	(date 1606938749913)
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+declare(strict_types=1);
+
+namespace Magento\CatalogExport\Plugin;
+
+use Magento\Setup\Module\Di\App\Task\Operation\ApplicationCodeGenerator;
+
+/**
+ * @see \Magento\Setup\Module\Di\App\Task\Operation\ApplicationCodeGenerator
+ */
+class GenerateApplicationCode
+{
+    /**
+     * @param ApplicationCodeGenerator $subject
+     * @return void
+     */
+    public function afterDoOperation(
+        ApplicationCodeGenerator $subject
+    ): void {
+        // TODO: Implement plugin method.
+        $result = true;
+    }
+}
\ No newline at end of file
Index: app/code/Magento/CatalogExport/etc/di.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/code/Magento/CatalogExport/etc/di.xml	(revision 47a365a72c81af47bab4b51f1196b4a95c285e69)
+++ app/code/Magento/CatalogExport/etc/di.xml	(date 1606944914618)
@@ -52,4 +52,7 @@
             </argument>
         </arguments>
     </type>
+    <type name="Magento\Setup\Module\Di\App\Task\Operation\ApplicationCodeGenerator">
+        <plugin name="GenerateGrpcCode" type="Magento\CatalogExport\Plugin\GenerateApplicationCode" sortOrder="0"/>
+    </type>
 </config>

-Moved export api generator code from CatalogExportApi to CatalogExport module
-Added plugin which generates dtos during setup:di:compile
@bricht
Copy link
Author

bricht commented Dec 3, 2020

@magento run all tests

jekabs added 3 commits December 4, 2020 17:26
-Improved generation class and fixed docblock bugs in generated classes
@bricht
Copy link
Author

bricht commented Dec 7, 2020

@magento run all tests

@bricht
Copy link
Author

bricht commented Dec 7, 2020

@magento run all tests

@bricht
Copy link
Author

bricht commented Dec 8, 2020

@magento run all tests

@bricht
Copy link
Author

bricht commented Dec 8, 2020

The WebAPI test failure has been fixed in magento/catalog-storefront#436 . Test is failing because the order of variants is not consistent, so it was using wrong variant to match.

The Static test failure doesnt make a whole lot of sense. It is saying that the generated getter/setter return type is invalid, which I expect is because the returned class might not exist at the time the test is run on the class, however it does exist by the end of generation.

For example:

Return typehint of method                                              
Magento\CatalogExportApi\Api\Data\Product::getImage() has invalid      
type Magento\CatalogExportApi\Api\Data\ImageDeprecated. 

@bricht
Copy link
Author

bricht commented Dec 8, 2020

The rest of the failures are unrelated to my changes from what I can tell

@bricht
Copy link
Author

bricht commented Dec 9, 2020

@magento run all tests

@RuslanKostiv1
Copy link
Contributor

@magento run Static Tests

@RuslanKostiv1
Copy link
Contributor

@magento run Static Tests

@RuslanKostiv1
Copy link
Contributor

@magento run Static Tests, Magento Health Index

@RuslanKostiv1
Copy link
Contributor

@magento run Static Tests, Magento Health Index

@RuslanKostiv1
Copy link
Contributor

@magento import pr to magento-commerce/commerce-data-export

@magento-engcom-team
Copy link

@RuslanKostiv1 the pull request successfully imported.

@mmansoor-magento mmansoor-magento merged commit e74ea72 into magento:main Dec 10, 2020
mmansoor-magento pushed a commit that referenced this pull request Dec 10, 2020
…e-data-export-2

[Imported] Support for ratings & reviews in Storefront App
magento-devops-reposync-svc pushed a commit that referenced this pull request Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CatalogExportApi autogeneration
7 participants