Skip to content

Commit 5722550

Browse files
committed
MC-18945: Reading deprecated annotation in schema
- added PR builds fixes
1 parent f3e1770 commit 5722550

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

dev/tests/integration/testsuite/Magento/Framework/GraphQl/Config/GraphQlDeprecatedAnnotationReaderTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ enumValues(includeDeprecated: true) {
194194
//Checks to make sure that the given description exists in the expectedOutput array
195195

196196
$this->assertTrue(
197-
array_key_exists(
197+
array_key_exists(
198198
array_search(
199199
'Comment for SortEnum',
200200
array_column($expectedOutput, 'description')
@@ -207,22 +207,20 @@ enumValues(includeDeprecated: true) {
207207
$fieldsArray = $expectedOutput[0]['fields'];
208208
$enumValuesArray = $expectedOutput[1]['enumValues'];
209209

210-
foreach($fieldsArray as $field){
211-
if ( $field['isDeprecated'] === true){
210+
foreach ($fieldsArray as $field) {
211+
if ($field['isDeprecated'] === true) {
212212
$typeDeprecatedReason [] = $field['deprecationReason'];
213213
}
214214
}
215215
$this->assertNotEmpty($typeDeprecatedReason);
216216
$this->assertContains('Deprecated url_path test', $typeDeprecatedReason);
217217

218-
foreach($enumValuesArray as $enumValue){
219-
if ( $enumValue['isDeprecated'] === true){
218+
foreach ($enumValuesArray as $enumValue) {
219+
if ($enumValue['isDeprecated'] === true) {
220220
$enumValueDeprecatedReason [] = $enumValue['deprecationReason'];
221221
}
222222
}
223-
224223
$this->assertNotEmpty($enumValueDeprecatedReason);
225224
$this->assertContains('Deprecated SortEnum Value test',$enumValueDeprecatedReason);
226-
227225
}
228226
}

lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/MetaReader/FieldMetaReader.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,14 @@ public function read(\GraphQL\Type\Definition\FieldDefinition $fieldMeta) : arra
9999
$result['arguments'][$argumentName]['defaultValue'] = $argumentMeta->defaultValue;
100100
}
101101
$typeMeta = $argumentMeta->getType();
102-
$result['arguments'][$argumentName] = array_merge(
103-
$result['arguments'][$argumentName],
104-
$this->typeMetaReader->read($typeMeta, TypeMetaWrapperReader::ARGUMENT_PARAMETER)
105-
);
102+
foreach ($result['arguments'][$argumentName] as $argument) {
103+
$argument = $this->typeMetaReader->read($typeMeta, TypeMetaWrapperReader::ARGUMENT_PARAMETER);
104+
return $argument;
105+
}
106+
// $result['arguments'][$argumentName] = array_merge_recursive(
107+
// $result['arguments'][$argumentName],
108+
// $this->typeMetaReader->read($typeMeta, TypeMetaWrapperReader::ARGUMENT_PARAMETER)
109+
// );
106110

107111
if ($this->docReader->read($argumentMeta->astNode->directives)) {
108112
$result['arguments'][$argumentName]['description'] =

0 commit comments

Comments
 (0)