Skip to content
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

Fix #673: name converter for Swagger and NelmioApiDocBundle #770

Merged
merged 1 commit into from
Sep 28, 2016

Conversation

meyerbaptiste
Copy link
Member

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #673
License MIT
Doc PR N/A

This PR fixes #673 by adding the support of the name converter system to Swagger and NelmioApiDocBundle.

@@ -171,7 +174,8 @@ private function getPropertyMetadata(ResourceMetadata $resourceMetadata, string
($propertyMetadata->isReadable() && self::OUT_PREFIX === $io) ||
($propertyMetadata->isWritable() && self::IN_PREFIX === $io)
) {
$data[$propertyName] = $this->parseProperty($resourceMetadata, $propertyMetadata, $io, null, $visited);
$normalizedPropertyName = null !== $this->nameConverter ? $this->nameConverter->normalize($propertyName) : $propertyName;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$this->nameConverter ? $this->nameConverter->normalize($propertyName) : $propertyName;? It doesn't hurt here because $this->nameConverter can only be null or a reference.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done for both @dunglas.

@@ -378,12 +381,13 @@ private function getDefinitionSchema(string $resourceClass, ResourceMetadata $re
$options = isset($serializerContext['groups']) ? ['serializer_groups' => $serializerContext['groups']] : [];
foreach ($this->propertyNameCollectionFactory->create($resourceClass, $options) as $propertyName) {
$propertyMetadata = $this->propertyMetadataFactory->create($resourceClass, $propertyName);
$normalizedPropertyName = null !== $this->nameConverter ? $this->nameConverter->normalize($propertyName) : $propertyName;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@teohhanhui teohhanhui added the bug label Sep 28, 2016
@dunglas dunglas merged commit c8d7403 into api-platform:master Sep 28, 2016
@dunglas
Copy link
Member

dunglas commented Sep 28, 2016

Thanks @meyerbaptiste

@meyerbaptiste meyerbaptiste deleted the fix_673 branch October 3, 2016 10:19
magarzon pushed a commit to magarzon/core that referenced this pull request Feb 12, 2017
Fix api-platform#673: name converter for Swagger and NelmioApiDocBundle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using a nameconvert is not reflected in the api doc
3 participants