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

Extending a parameter that extends another parameter doesn't work as expected #184

Open
garrettrathbone opened this issue Oct 12, 2022 · 0 comments

Comments

@garrettrathbone
Copy link

Description
If a model/parameter (model 1) extends another model/parameter (model 2) that itself extends another model/parameter (model 3), it should be assumed that model 1 has properties that were pulled through from model 3, but instead only values from model 2 are pulled through.

How to reproduce
Create 3 models:

  • model 3 have a property on it
  • model 2 extends model 3 with a different property
  • model 1 extends model 2

You'd expect model 1 to then have properties from both model 2 and 3, but it only has properties from model 2.

Possible Solution
I believe the issue is being caused from when the extends is converted to an array to add to the data on parameter construction in the Parameter class.
$data += $extends->toArray(); The toArray method returns the originalData property, which is never modified even when extending.

The possible solution would be to additionally merge the $extends->toArray() data in with the $this->originalData at the same time as when it's added to the current $data. Either that or set $data to $this->originalData (which currently happens first) after the $ref and extends functionality is ran.

garrettrathbone added a commit to garrettrathbone/guzzle-services that referenced this issue Oct 12, 2022
Set $data to originalData after extend to allow nested models that are extended by other models to pass properties through to parents, per issue 184 (guzzle#184).
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

No branches or pull requests

1 participant