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 openapi normalization #4325

Merged
merged 3 commits into from
Jun 25, 2021

Conversation

tassilogroeper
Copy link
Contributor

@tassilogroeper tassilogroeper commented Jun 15, 2021

Q A
Branch? 2.6
Tickets #4318
License MIT

As described in issue #4318 the function recursiveClean does nest one more time and fails, if an ApiResource has a property named paths. Updated tests to reproduce the failing parts.

This is version 2, a more general approach, since the logic inside \ApiPlatform\Core\OpenApi\Serializer\OpenApiNormalizer::recursiveClean was doing two things:

  1. cleaning out extensionProperties keys in a recursion and
  2. with every recursion, trying to sort the schemas and paths properties of the OpenApi object

So why not do the sorting in the Object generation directly and fix the double nested paths issue with the normalizing call itself.

Idea is taken from: Using Callbacks to Serialize Properties with Object Instances

@tassilogroeper
Copy link
Contributor Author

tassilogroeper commented Jun 15, 2021

relates to #4319

src/OpenApi/Model/Components.php Outdated Show resolved Hide resolved
Copy link
Member

@alanpoulain alanpoulain left a comment

Choose a reason for hiding this comment

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

LGTM, could you rebase?

@tassilogroeper
Copy link
Contributor Author

LGTM, could you rebase?

@alanpoulain done

@alanpoulain alanpoulain merged commit 4f363fc into api-platform:2.6 Jun 25, 2021
@alanpoulain
Copy link
Member

Thank you @pheadeaux.

@WilliamPeralta
Copy link
Contributor

@dunglas @pheadeaux can someone publish this tag? is not yet available :( i manually install 2.6 branch
Thanks.

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

4 participants