diff --git a/src/Swagger/Serializer/DocumentationNormalizer.php b/src/Swagger/Serializer/DocumentationNormalizer.php index 411adbf98b4..4e55281927e 100644 --- a/src/Swagger/Serializer/DocumentationNormalizer.php +++ b/src/Swagger/Serializer/DocumentationNormalizer.php @@ -550,7 +550,9 @@ private function getDefinition(bool $v3, \ArrayObject $definitions, ResourceMeta { $keyPrefix = $resourceMetadata->getShortName(); if (null !== $publicClass) { - $keyPrefix .= ':'.md5($publicClass); + $parts = explode('\\', $publicClass); + $shortName = end($parts); + $keyPrefix .= ':'.$shortName; } if (isset($serializerContext[self::SWAGGER_DEFINITION_NAME])) { diff --git a/tests/Swagger/Serializer/DocumentationNormalizerV2Test.php b/tests/Swagger/Serializer/DocumentationNormalizerV2Test.php index cb5756e69ce..40436c4b535 100644 --- a/tests/Swagger/Serializer/DocumentationNormalizerV2Test.php +++ b/tests/Swagger/Serializer/DocumentationNormalizerV2Test.php @@ -2374,7 +2374,7 @@ public function testNormalizeWithInputAndOutpusClass() 'schema' => [ 'type' => 'array', 'items' => [ - '$ref' => '#/definitions/Dummy:300dcd476cef011532fb0ca7683395d7', + '$ref' => '#/definitions/Dummy:OutputDto', ], ], ], @@ -2399,7 +2399,7 @@ public function testNormalizeWithInputAndOutpusClass() 201 => [ 'description' => 'Dummy resource created', 'schema' => [ - '$ref' => '#/definitions/Dummy:300dcd476cef011532fb0ca7683395d7', + '$ref' => '#/definitions/Dummy:OutputDto', ], ], 400 => [ @@ -2415,7 +2415,7 @@ public function testNormalizeWithInputAndOutpusClass() 'in' => 'body', 'description' => 'The new Dummy resource', 'schema' => [ - '$ref' => '#/definitions/Dummy:b4f76c1a44965bd401aa23bb37618acc', + '$ref' => '#/definitions/Dummy:InputDto', ], ], ], @@ -2439,7 +2439,7 @@ public function testNormalizeWithInputAndOutpusClass() 200 => [ 'description' => 'Dummy resource response', 'schema' => [ - '$ref' => '#/definitions/Dummy:300dcd476cef011532fb0ca7683395d7', + '$ref' => '#/definitions/Dummy:OutputDto', ], ], 404 => [ @@ -2465,7 +2465,7 @@ public function testNormalizeWithInputAndOutpusClass() 'in' => 'body', 'description' => 'The updated Dummy resource', 'schema' => [ - '$ref' => '#/definitions/Dummy:b4f76c1a44965bd401aa23bb37618acc', + '$ref' => '#/definitions/Dummy:InputDto', ], ], ], @@ -2473,7 +2473,7 @@ public function testNormalizeWithInputAndOutpusClass() 200 => [ 'description' => 'Dummy resource updated', 'schema' => [ - '$ref' => '#/definitions/Dummy:300dcd476cef011532fb0ca7683395d7', + '$ref' => '#/definitions/Dummy:OutputDto', ], ], 400 => [ @@ -2487,7 +2487,7 @@ public function testNormalizeWithInputAndOutpusClass() ], ]), 'definitions' => new \ArrayObject([ - 'Dummy:300dcd476cef011532fb0ca7683395d7' => new \ArrayObject([ + 'Dummy:OutputDto' => new \ArrayObject([ 'type' => 'object', 'description' => 'This is a dummy.', 'externalDocs' => [ @@ -2505,7 +2505,7 @@ public function testNormalizeWithInputAndOutpusClass() ]), ], ]), - 'Dummy:b4f76c1a44965bd401aa23bb37618acc' => new \ArrayObject([ + 'Dummy:InputDto' => new \ArrayObject([ 'type' => 'object', 'description' => 'This is a dummy.', 'externalDocs' => [