Skip to content

Added the ability to use entity properties in metadata #76

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 5 commits into from
Nov 28, 2018
Merged

Added the ability to use entity properties in metadata #76

merged 5 commits into from
Nov 28, 2018

Conversation

rocketweb
Copy link

@rocketweb rocketweb commented Apr 2, 2018

Description

Added the ability to use entity properties inside metadata entities for when you make API requests to create something that has to contain an array of properties from other entities, e.g. the request for creating a new tax rule has to contain an array of the ids of the tax rates that will be associated to it.

Now you can have a meta file that represents a tax rate, which would look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd">
    <operation name="CreateTaxRate" dataType="tax_rate" type="create" auth="adminOauth" url="/V1/taxRates" method="POST">
        <contentType>application/json</contentType>
        <object dataType="tax_rate" key="taxRate">
            <field key="code">string</field>
            <field key="tax_country_id">string</field>
            <field key="tax_region_id">integer</field>
            <field key="tax_postcode">string</field>
            <field key="rate">integer</field>
        </object>
    </operation>
</operations>

And a meta file that represents a tax rule, which would look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd">
    <operation name="CreateTaxRule" dataType="tax_rule" type="create" auth="adminOauth" url="/V1/taxRules" method="POST">
        <contentType>application/json</contentType>
        <object dataType="tax_rule" key="rule">
            <field key="code">string</field>
            <field key="priority">integer</field>
            <field key="position">integer</field>
            <array key="customer_tax_class_ids">
                <value>integer</value>
            </array>
            <array key="product_tax_class_ids">
                <value>integer</value>
            </array>
            <array key="tax_rate_ids">
                <value>tax_rate.id</value>
            </array>
        </object>
    </operation>
</operations>

Notice the <value>tax_rate.id</value> inside the tax_rule entity. Now a tax rule can be created successfully.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/verification tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)
  • Changes to Framework doesn't have backward incompatible changes for tests or have related Pull Request with fixes to tests

@okolesnyk okolesnyk self-assigned this Apr 2, 2018
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 52.37% when pulling 73c4371 on rocketweb:use-entity-properties-in-metadata into bf24553 on magento:develop.

@magento magento deleted a comment from coveralls Apr 2, 2018
@magento magento deleted a comment from coveralls Apr 2, 2018
@okolesnyk
Copy link
Member

Hi again.
For this ticket I also created internal ticket MQE-911.
And I will update you as soon as possible on progress of this ticket here.

@okolesnyk okolesnyk added this to the 2.2.1 milestone Apr 17, 2018
@okolesnyk okolesnyk added Partner: Rocket Web Pull Request is created by partner Rocket Web partners-contribution Pull Request is created by Magento Partner labels Apr 23, 2018
@okolesnyk
Copy link
Member

Hello, @rocketweb
Please sign licence/cla, because otherwise I can not process this Pull Request.

@okolesnyk okolesnyk modified the milestones: 2.2.1, 2.2.0, 2.3.0 Jun 18, 2018
@KevinBKozan
Copy link
Contributor

@rocketweb,
Following up with you about the license/CLA. If you could please sign the license/cla we can process this Pull Request.

@okolesnyk
Copy link
Member

@rocketweb Thank you very much, we will include it into 2.3.1 upcoming release.

@okolesnyk okolesnyk modified the milestones: 2.3.0, 2.3.1 Jul 18, 2018
@okolesnyk okolesnyk assigned aljcalandra and KevinBKozan and unassigned okolesnyk Oct 5, 2018
@okolesnyk okolesnyk modified the milestones: 2.3.1, 2.3.9 Oct 5, 2018
jilu1
jilu1 previously requested changes Oct 15, 2018
Copy link
Contributor

@jilu1 jilu1 left a comment

Choose a reason for hiding this comment

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

@rocketweb Thanks for your contribution! I have pulled your PR into our current develop branch, setup tax rate and tax rule meta data as described in PR, I tried a few ways to setup data and test for tax rule, but could not persist tax rule data correctly. Could you please send us your data, meta data, and test for us to review?

@okolesnyk okolesnyk self-requested a review November 28, 2018 21:29
@okolesnyk okolesnyk dismissed jilu1’s stale review November 28, 2018 21:30

Issue resolved.

@okolesnyk okolesnyk merged commit 317323c into magento:develop Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accept Partner: Rocket Web Pull Request is created by partner Rocket Web partners-contribution Pull Request is created by Magento Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants