@@ -87,13 +87,7 @@ public function resolve(): DbModel
87
87
/** @var $property PropertySchema */
88
88
89
89
$ isRequired = $ this ->componentSchema ->isRequiredProperty ($ property ->getName ());
90
- $ nullableValue = false ; # https://github.com/OAI/OpenAPI-Specification/blob/main/proposals/2019-10-31-Clarify-Nullable.md
91
-
92
- if ($ property ->hasAttr ('nullable ' )) {
93
- if ($ property ->getAttr ('nullable ' ) === true ) {
94
- $ nullableValue = true ;
95
- }
96
- }
90
+ $ nullableValue = $ this ->nullableValue ($ property );
97
91
98
92
if ($ this ->isJunctionSchema ) {
99
93
$ this ->resolveJunctionTableProperty ($ property , $ isRequired );
@@ -214,10 +208,7 @@ protected function resolveProperty(
214
208
$ nullableValue = 'ARG_ABSENT '
215
209
): void {
216
210
if ($ nullableValue === 'ARG_ABSENT ' ) {
217
- $ nullableValue = false ;
218
- if ($ property ->hasAttr ('nullable ' ) && $ property ->getAttr ('nullable ' ) === true ) {
219
- $ nullableValue = true ;
220
- }
211
+ $ nullableValue = $ this ->nullableValue ($ property );
221
212
}
222
213
$ attribute = Yii::createObject (Attribute::class, [$ property ->getName ()]);
223
214
@@ -542,4 +533,18 @@ public function addInverseRelation(
542
533
$ inverseRelation ->setInverse ($ property ->getName ());
543
534
$ this ->inverseRelations [$ relatedClassName ][] = $ inverseRelation ;
544
535
}
536
+
537
+ /**
538
+ * Compute nullable value
539
+ */
540
+ private function nullableValue (PropertySchema $ property ): bool
541
+ {
542
+ $ nullableValue = false ; # https://github.com/OAI/OpenAPI-Specification/blob/main/proposals/2019-10-31-Clarify-Nullable.md
543
+
544
+ if ($ property ->hasAttr ('nullable ' ) && $ property ->getAttr ('nullable ' ) === true ) {
545
+ $ nullableValue = true ;
546
+ }
547
+
548
+ return $ nullableValue ;
549
+ }
545
550
}
0 commit comments