Skip to content

Commit 037a5b5

Browse files
committed
MC-18945: Reading deprecated annotation in schema
- added the changes form review
1 parent a1afd8f commit 037a5b5

File tree

2 files changed

+4
-19
lines changed
  • app/code/Magento/DownloadableGraphQl/etc
  • lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/Reader

2 files changed

+4
-19
lines changed

app/code/Magento/DownloadableGraphQl/etc/schema.graphqls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ type DownloadableProduct implements ProductInterface, CustomizableProductInterfa
5353
links_title: String @doc(description: "The heading above the list of downloadable products")
5454
}
5555

56-
enum DownloadableFileTypeEnum @deprecated(reason: "`sample_url` serves to get the downloadable sample") {
57-
FILE
56+
enum DownloadableFileTypeEnum {
57+
FILE @deprecated(reason: "`sample_url` serves to get the downloadable sample")
5858
URL
5959
}
6060

lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/Reader/EnumType.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
use Magento\Framework\GraphQlSchemaStitching\GraphQlReader\TypeMetaReaderInterface;
1111
use Magento\Framework\GraphQlSchemaStitching\GraphQlReader\MetaReader\DocReader;
12-
use Magento\Framework\GraphQlSchemaStitching\GraphQlReader\MetaReader\DeprecatedEnumAnnotationReader;
12+
1313

1414
/**
1515
* Composite configuration reader to handle the enum type meta
@@ -21,21 +21,13 @@ class EnumType implements TypeMetaReaderInterface
2121
*/
2222
private $docReader;
2323

24-
/**
25-
* @var DeprecatedEnumAnnotationReader
26-
*/
27-
private $deprecatedEnumAnnotationReader;
28-
2924
/**
3025
* @param DocReader $docReader
31-
* @param DeprecatedEnumAnnotationReader $deprecatedEnumAnnotationReader
3226
*/
3327
public function __construct(
34-
DocReader $docReader,
35-
DeprecatedEnumAnnotationReader $deprecatedEnumAnnotationReader
28+
DocReader $docReader
3629
) {
3730
$this->docReader = $docReader;
38-
$this->deprecatedEnumAnnotationReader = $deprecatedEnumAnnotationReader;
3931
}
4032

4133
/**
@@ -61,13 +53,6 @@ public function read(\GraphQL\Type\Definition\Type $typeMeta) : array
6153
$result['items'][$enumValueMeta->value]['description'] =
6254
$this->docReader->read($enumValueMeta->astNode->directives);
6355
}
64-
65-
if (!empty($enumValueMeta->deprecationReason) &&
66-
$this->deprecatedEnumAnnotationReader->read($enumValueMeta->astNode->directives)
67-
) {
68-
$result['items'][$enumValueMeta->value]['deprecationReason'] =
69-
$this->deprecatedEnumAnnotationReader->read($enumValueMeta->astNode->directives);
70-
}
7156
}
7257

7358
if ($this->docReader->read($typeMeta->astNode->directives)) {

0 commit comments

Comments
 (0)