Skip to content

Commit 299375f

Browse files
authored
Fix the generated code for enum-based map keys for json services (#1602)
* Fix the generated code for enum-based map keys for json services * Fix the changelog test for changes in the CodeGenerator The CodeGenerator package does not have a changelog as it has no releases.
1 parent bcf7d61 commit 299375f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Generator/RequestSerializer/RestJsonSerializer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ private function dumpArrayMap(string $output, string $input, string $contextProp
227227
$mapKeyShape = $shape->getKey()->getShape();
228228
if (!empty($mapKeyShape->getEnum())) {
229229
$enumClassName = $this->namespaceRegistry->getEnum($mapKeyShape);
230-
$validateEnum = strtr('if (!ENUM_CLASS::exists($mapKey)) {
231-
throw new InvalidArgument(sprintf(\'Invalid key for "%s". The value "%s" is not a valid "ENUM_CLASS".\', __CLASS__, $mapKey));
230+
$validateEnum = strtr('if (!ENUM_CLASS::exists($name)) {
231+
throw new InvalidArgument(sprintf(\'Invalid key for "%s". The value "%s" is not a valid "ENUM_CLASS".\', __CLASS__, $name));
232232
}', [
233233
'ENUM_CLASS' => $enumClassName->getName(),
234234
]);

0 commit comments

Comments
 (0)