Skip to content

Avoid calling getSerializableData() #98

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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP 2
  • Loading branch information
SOHELAHMED7 committed Mar 10, 2025
commit 7d0f71fb8548089e0d59cce4b92c43cba2c5843b
16 changes: 10 additions & 6 deletions src/lib/AttributeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ public function resolve(): DbModel
/** @var $property PropertySchema */

$isRequired = $this->componentSchema->isRequiredProperty($property->getName());
$nullableValue = $property->getProperty()->getSerializableData()->nullable ?? null;
if ($nullableValue === false) { // see docs in README regarding NOT NULL, required and nullable
$isRequired = true;
$nullableValue = false; # https://github.com/OAI/OpenAPI-Specification/blob/main/proposals/2019-10-31-Clarify-Nullable.md

if ($property->hasAttr('nullable')) {
if ($property->getAttr('nullable') === true) {
$nullableValue = true;
}
}

if ($this->isJunctionSchema) {
Expand Down Expand Up @@ -211,9 +214,10 @@ protected function resolveProperty(
$nullableValue = 'ARG_ABSENT'
): void {
if ($nullableValue === 'ARG_ABSENT') {
// $nullableValue = $property->getProperty()->getSerializableData()->nullable ?? null;
// $nullableValue = $property->getAttr('nullable') ?? null;
$nullableValue = $property->getProperty()->nullable ?? null;
$nullableValue = false;
if ($property->hasAttr('nullable') && $property->getAttr('nullable') === true) {
$nullableValue = true;
}
}
$attribute = Yii::createObject(Attribute::class, [$property->getName()]);

Expand Down
Loading