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: use short name when generating parameter description #6155

Conversation

priyadi
Copy link
Contributor

@priyadi priyadi commented Feb 12, 2024

Q A
Branch? 3.2
Tickets
License MIT
Doc PR

OpenApiFactory previously only uses class name when generating parameter description, and did not respect the shortName parameter. This PR fixes the problem.

@priyadi priyadi force-pushed the fix/short-name-parameter-description-2 branch from 2914bda to 0a84f49 Compare February 12, 2024 09:28
@priyadi priyadi force-pushed the fix/short-name-parameter-description-2 branch from 0a84f49 to 3fee80b Compare February 12, 2024 09:37
@@ -265,7 +265,14 @@ private function collectPaths(ApiResource $resource, ResourceMetadataCollection
continue;
}

$parameter = new Parameter($parameterName, 'path', (new \ReflectionClass($uriVariable->getFromClass()))->getShortName().' identifier', true, false, false, ['type' => 'string']);
$fromClass = $this->resourceMetadataFactory->create($uriVariable->getFromClass());
Copy link
Member

Choose a reason for hiding this comment

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

interesting but I think that this is quite a lot of work, probably that this should actually get fixed by #5995

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if I understand. I don't use any filtering feature at all. My Problem is simply this:

image

This is BookDto as an ApiResource with its shortName set to Book. As you can see, all the labels are correct, except for the one in the parameter. All this time we had to fix it by overriding it in openapiContext.

@soyuka soyuka added the bug label Feb 16, 2024
soyuka pushed a commit to Timu57/core that referenced this pull request Feb 29, 2024
soyuka pushed a commit that referenced this pull request Feb 29, 2024
@soyuka soyuka closed this Feb 29, 2024
@soyuka
Copy link
Member

soyuka commented Feb 29, 2024

let me know if you still have an issue with this patch, I'm releasing it soon

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.

None yet

2 participants