You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using compositions the properties of the compositions are transferred to the main object. Independently of the implicitNull setting and the required state of the properties which are transferred from a composition the function signatures for getters and the DocBlocks for the properties are nullable.
With implicitNull setters of required properties become also nullable (although the validation performs correct checks and it will consequently fail if null is provided). Should be solved via the function signature.
Schema
{
"$id": "Person",
"allOf": [
{
"type": "object",
"properties": {
"age": {
"type": "integer",
"description": "The age of the person",
"example": 42
}
}
},
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the person",
"example": "Lawrence"
}
},
"required": [
"name"
]
}
]
}
implicitNull disabled
generated interface
/** @var int|null The age of the person */protected$age = NULL;
/** @var string|null The name of the person */protected$name = NULL;
publicfunction getAge(): ?int
public function setAge(int$age): self
public function getName(): ?string
public function setName(string$name): self
expected interface
/** @var int|null The age of the person */protected$age = NULL;
/** @var string The name of the person */protected$name;
publicfunction getAge(): ?int
public function setAge(int$age): self
public function getName(): string
public function setName(string$name): self
implicitNull enabled
generated interface
/** @var int|null The age of the person */protected$age = NULL;
/** @var string|null The name of the person */protected$name = NULL;
publicfunction getAge(): ?int
public function setAge(?int$age): self
public function getName(): ?string
public function setName(?string$name): self
expected interface
/** @var int|null The age of the person */protected$age = NULL;
/** @var string The name of the person */protected$name;
publicfunction getAge(): ?int
public function setAge(?int$age): self
public function getName(): string
public function setName(string$name): self
Version:
all versions
The text was updated successfully, but these errors were encountered:
This behaviour only applies to the allOf composition as for all other compositions it can't be ensured the property must be set. Consequently for all other compositions the properties are set to nullable on the main object.
If the internal state of the object gets invalid by changing a property to null an exception will be thrown as the validations are executed. (compare changes made by the CompositionValidationPostProcessor)
Describe the bug
When using compositions the properties of the compositions are transferred to the main object. Independently of the
implicitNull
setting and therequired
state of the properties which are transferred from a composition the function signatures for getters and the DocBlocks for the properties are nullable.With
implicitNull
setters of required properties become also nullable (although the validation performs correct checks and it will consequently fail if null is provided). Should be solved via the function signature.Schema
implicitNull disabled
generated interface
expected interface
implicitNull enabled
generated interface
expected interface
Version:
all versions
The text was updated successfully, but these errors were encountered: