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 missing $ref in OpenApi documentation (#4009) #4076

Merged
merged 3 commits into from
Feb 17, 2021

Conversation

RobinHoutevelts
Copy link
Contributor

Q A
Branch? 2.6
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #4009
License MIT
Doc PR

In #3957 a change got introduced that unintentionally removed $ref's from the OpenApi documentation in some cases. The PR changed an existing test without adding a new one.

$propertySchema is filled with the type that gets passed in the @ApiProperty() openapi_context or swagger_context attribute. So in the previous PR it was thought that whenever $propertySchema contains something it was certainly filled because someone tried to define their own type and we shouldn't add a $ref. However $propertySchema is also filled with description whenever a description exists.

So at the moment when you add a description to your method, you lose the $ref.

This PR makes sure the $ref is only removed when a $propertySchema['type'] is set.

I've also updated the test with a property that has the swagger_context with a type set.

CHANGELOG.md Outdated Show resolved Hide resolved
@alanpoulain alanpoulain merged commit 00b1c06 into api-platform:2.6 Feb 17, 2021
@alanpoulain
Copy link
Member

Thank you @RobinHoutevelts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants