Skip to content

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

@garrettrathbone

Description

@garrettrathbone

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions