We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
4.3.0
When setting a #[Property] changing the type of the property, nullable is ignored and the result json makes the property nullable:
This is my code:
class UserStyleDto extends AbstractDto { private StyleDto $style; #[Property(ref: new Model(type: CodeCaptionDto::class), nullable: false)] private StyleLevelEnum $level; public function __construct(UserStyle $userStyle) { $this->style = new StyleDto($userStyle->getStyle()); $this->level = $userStyle->getLevel(); } public function getStyle(): StyleDto { return $this->style; } public function getLevel(): StyleLevelEnum { return $this->level; } }
To make $level not nullable, I have to add #[Assert\NotNull].
If I don't use the #[Property] then the $level is not nullabel correctly.
I have a Normalizer that normalizes the StyleLevelEnum to a CodeCaptionDto.
"UserStyleDto": { "required": [ "style" ], "properties": { "style": { "$ref": "#/components/schemas/StyleDto" }, "level": { "$ref": "#/components/schemas/CodeCaptionDto" } }, "type": "object" },
May be related with this issue: #2111
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Version
4.3.0
Description
When setting a #[Property] changing the type of the property, nullable is ignored and the result json makes the property nullable:
This is my code:
To make $level not nullable, I have to add #[Assert\NotNull].
If I don't use the #[Property] then the $level is not nullabel correctly.
I have a Normalizer that normalizes the StyleLevelEnum to a CodeCaptionDto.
JSON OpenApi
JSON OpenApi
Additional context
May be related with this issue: #2111
The text was updated successfully, but these errors were encountered: