Skip to content

[GraphQl] The fields that described below has been deprecated #30694

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions app/code/Magento/CatalogGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,21 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\
description: ComplexTextValue @doc(description: "Detailed information about the product. The value can include simple HTML tags.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductComplexTextAttribute")
short_description: ComplexTextValue @doc(description: "A short description of the product. Its use depends on the theme.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductComplexTextAttribute")
special_price: Float @doc(description: "The discounted price of the product.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\SpecialPrice")
special_from_date: String @doc(description: "The beginning date that a product has a special price.")
special_from_date: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "The beginning date that a product has a special price.")
special_to_date: String @doc(description: "The end date that a product has a special price.")
attribute_set_id: Int @doc(description: "The attribute set assigned to the product.")
attribute_set_id: Int @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "The attribute set assigned to the product.")
meta_title: String @doc(description: "A string that is displayed in the title bar and tab of the browser and in search results lists.")
meta_keyword: String @doc(description: "A comma-separated list of keywords that are visible only to search engines.")
meta_description: String @doc(description: "A brief overview of the product for search results listings, maximum 255 characters.")
image: ProductImage @doc(description: "The relative path to the main image on the product page.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductImage")
small_image: ProductImage @doc(description: "The relative path to the small image, which is used on catalog pages.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductImage")
thumbnail: ProductImage @doc(description: "The relative path to the product's thumbnail image.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductImage")
new_from_date: String @doc(description: "The beginning date for new product listings, and determines if the product is featured as a new product.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\NewFromTo")
new_to_date: String @doc(description: "The end date for new product listings.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\NewFromTo")
new_from_date: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "The beginning date for new product listings, and determines if the product is featured as a new product.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\NewFromTo")
new_to_date: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "The end date for new product listings.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\NewFromTo")
tier_price: Float @deprecated(reason: "Use price_tiers for product tier price information.") @doc(description: "The price when tier pricing is in effect and the items purchased threshold has been reached.")
options_container: String @doc(description: "If the product has multiple options, determines where they appear on the product page.")
created_at: String @doc(description: "Timestamp indicating when the product was created.")
updated_at: String @doc(description: "Timestamp indicating when the product was updated.")
created_at: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Timestamp indicating when the product was created.")
updated_at: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Timestamp indicating when the product was updated.")
country_of_manufacture: String @doc(description: "The product's country of origin.")
type_id: String @doc(description: "One of simple, virtual, bundle, downloadable, grouped, or configurable.") @deprecated(reason: "Use __typename instead.")
websites: [Website] @doc(description: "An array of websites in which the product is available.") @deprecated(reason: "The field should not be used on the storefront.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\Websites")
Expand Down Expand Up @@ -249,8 +249,8 @@ interface CategoryInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model
canonical_url: String @doc(description: "Relative canonical URL. This value is returned only if the system setting 'Use Canonical Link Meta Tag For Categories' is enabled") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Category\\CanonicalUrl")
position: Int @doc(description: "The position of the category relative to other categories at the same level in tree.")
level: Int @doc(description: "Indicates the depth of the category within the tree.")
created_at: String @doc(description: "Timestamp indicating when the category was created.")
updated_at: String @doc(description: "Timestamp indicating when the category was updated.")
created_at: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Timestamp indicating when the category was created.")
updated_at: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Timestamp indicating when the category was updated.")
product_count: Int @doc(description: "The number of products in the category that are marked as visible. By default, in complex products, parent products are visible, but their child products are not.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Category\\ProductsCount")
default_sort_by: String @doc(description: "The attribute to use for sorting.")
products(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public function testAllFieldsBundleProducts()
type_id
id
name
attribute_set_id
... on PhysicalProductInterface {
weight
}
Expand All @@ -54,7 +53,7 @@ public function testAllFieldsBundleProducts()
required
type
position
sku
sku
options {
id
quantity
Expand All @@ -74,7 +73,7 @@ public function testAllFieldsBundleProducts()
}
}
}
}
}
}
QUERY;

Expand Down Expand Up @@ -118,7 +117,6 @@ public function testBundleProductWithNotVisibleChildren()
type_id
id
name
attribute_set_id
... on PhysicalProductInterface {
weight
}
Expand All @@ -134,7 +132,7 @@ public function testBundleProductWithNotVisibleChildren()
required
type
position
sku
sku
options {
id
quantity
Expand All @@ -154,7 +152,7 @@ public function testBundleProductWithNotVisibleChildren()
}
}
}
}
}
}
QUERY;

Expand Down Expand Up @@ -207,8 +205,7 @@ private function assertBundleBaseFields($product, $actualResponse)
['response_field' => 'type_id', 'expected_value' => $product->getTypeId()],
['response_field' => 'id', 'expected_value' => $product->getId()],
['response_field' => 'name', 'expected_value' => $product->getName()],
['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()],
['response_field' => 'weight', 'expected_value' => $product->getWeight()],
['response_field' => 'weight', 'expected_value' => $product->getWeight()],
['response_field' => 'dynamic_price', 'expected_value' => !(bool)$product->getPriceType()],
['response_field' => 'dynamic_weight', 'expected_value' => !(bool)$product->getWeightType()],
['response_field' => 'dynamic_sku', 'expected_value' => !(bool)$product->getSkuType()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,7 @@ public function testCategoryProducts()
page_size
}
items {
attribute_set_id
country_of_manufacture
created_at
description {
html
}
Expand Down Expand Up @@ -349,8 +347,6 @@ public function testCategoryProducts()
}
}
name
new_from_date
new_to_date
options_container
price {
minimalPrice {
Expand Down Expand Up @@ -409,7 +405,6 @@ public function testCategoryProducts()
sku
small_image { url, label }
thumbnail { url, label }
special_from_date
special_price
special_to_date
swatch_image
Expand All @@ -422,17 +417,8 @@ public function testCategoryProducts()
website_id
}
type_id
updated_at
url_key
url_path
websites {
id
name
code
sort_order
default_group_id
is_default
}
}
}
}
Expand All @@ -453,7 +439,6 @@ public function testCategoryProducts()
$firstProductModel = $productRepository->get($firstProduct['sku'], false, null, true);
$this->assertBaseFields($firstProductModel, $firstProduct);
$this->assertAttributes($firstProduct);
$this->assertWebsites($firstProductModel, $firstProduct['websites']);
$this->assertEquals('Category 1', $firstProduct['categories'][0]['name']);
$this->assertEquals('category-1/category-1-1', $firstProduct['categories'][1]['url_path']);
$this->assertCount(3, $firstProduct['categories']);
Expand Down Expand Up @@ -664,8 +649,6 @@ public function categoryImageDataProvider(): array
private function assertBaseFields($product, $actualResponse)
{
$assertionMap = [
['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()],
['response_field' => 'created_at', 'expected_value' => $product->getCreatedAt()],
['response_field' => 'name', 'expected_value' => $product->getName()],
['response_field' => 'price', 'expected_value' => [
'minimalPrice' => [
Expand Down Expand Up @@ -693,30 +676,10 @@ private function assertBaseFields($product, $actualResponse)
],
['response_field' => 'sku', 'expected_value' => $product->getSku()],
['response_field' => 'type_id', 'expected_value' => $product->getTypeId()],
['response_field' => 'updated_at', 'expected_value' => $product->getUpdatedAt()],
];
$this->assertResponseFields($actualResponse, $assertionMap);
}

/**
* @param ProductInterface $product
* @param array $actualResponse
*/
private function assertWebsites($product, $actualResponse)
{
$assertionMap = [
[
'id' => current($product->getExtensionAttributes()->getWebsiteIds()),
'name' => 'Main Website',
'code' => 'base',
'sort_order' => 0,
'default_group_id' => '1',
'is_default' => true,
]
];
$this->assertEquals($actualResponse, $assertionMap);
}

/**
* @param array $actualResponse
*/
Expand All @@ -731,11 +694,8 @@ private function assertAttributes($actualResponse)
'short_description',
'country_of_manufacture',
'gift_message_available',
'new_from_date',
'new_to_date',
'options_container',
'special_price',
'special_from_date',
'special_to_date',
];
foreach ($eavAttributes as $eavAttribute) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,7 @@ public function testCategoryProducts()
page_size
}
items {
attribute_set_id
country_of_manufacture
created_at
description {
html
}
Expand Down Expand Up @@ -374,8 +372,6 @@ public function testCategoryProducts()
}
}
name
new_from_date
new_to_date
options_container
price {
minimalPrice {
Expand Down Expand Up @@ -434,7 +430,6 @@ public function testCategoryProducts()
sku
small_image { url, label }
thumbnail { url, label }
special_from_date
special_price
special_to_date
swatch_image
Expand All @@ -447,17 +442,8 @@ public function testCategoryProducts()
website_id
}
type_id
updated_at
url_key
url_path
websites {
id
name
code
sort_order
default_group_id
is_default
}
}
}
}
Expand All @@ -478,7 +464,6 @@ public function testCategoryProducts()
$firstProduct = $productRepository->get($firstProductSku, false, null, true);
$this->assertBaseFields($firstProduct, $response['category']['products']['items'][0]);
$this->assertAttributes($response['category']['products']['items'][0]);
$this->assertWebsites($firstProduct, $response['category']['products']['items'][0]['websites']);
}

/**
Expand Down Expand Up @@ -688,8 +673,6 @@ public function categoryImageDataProvider(): array
private function assertBaseFields($product, $actualResponse)
{
$assertionMap = [
['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()],
['response_field' => 'created_at', 'expected_value' => $product->getCreatedAt()],
['response_field' => 'name', 'expected_value' => $product->getName()],
['response_field' => 'price', 'expected_value' => [
'minimalPrice' => [
Expand Down Expand Up @@ -717,30 +700,10 @@ private function assertBaseFields($product, $actualResponse)
],
['response_field' => 'sku', 'expected_value' => $product->getSku()],
['response_field' => 'type_id', 'expected_value' => $product->getTypeId()],
['response_field' => 'updated_at', 'expected_value' => $product->getUpdatedAt()],
];
$this->assertResponseFields($actualResponse, $assertionMap);
}

/**
* @param ProductInterface $product
* @param array $actualResponse
*/
private function assertWebsites($product, $actualResponse)
{
$assertionMap = [
[
'id' => current($product->getExtensionAttributes()->getWebsiteIds()),
'name' => 'Main Website',
'code' => 'base',
'sort_order' => 0,
'default_group_id' => '1',
'is_default' => true,
]
];
$this->assertEquals($actualResponse, $assertionMap);
}

/**
* @param array $actualResponse
*/
Expand All @@ -755,12 +718,8 @@ private function assertAttributes($actualResponse)
'short_description',
'country_of_manufacture',
'gift_message_available',
'new_from_date',
'new_to_date',
'options_container',
'special_price',
'special_from_date',
'special_to_date',
'special_price'
];
foreach ($eavAttributes as $eavAttribute) {
$this->assertArrayHasKey($eavAttribute, $actualResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testQuerySimpleProductAfterDelete()
products(filter: {sku: {eq: "{$productSku}"}})
{
items {
attribute_set_id
id
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Magento\TestFramework\TestCase\GraphQlAbstract;

/**
* Class ProductInMultipleStoresTest
* The GraphQl test for product in multiple stores
*/
class ProductInMultipleStoresTest extends GraphQlAbstract
{
Expand All @@ -31,8 +31,6 @@ public function testProductFromSpecificAndDefaultStore()
products(filter: {sku: {eq: "{$productSku}"}})
{
items {
attribute_set_id
created_at
id
name
price {
Expand All @@ -45,7 +43,6 @@ public function testProductFromSpecificAndDefaultStore()
}
sku
type_id
updated_at
... on PhysicalProductInterface {
weight
}
Expand Down
Loading