From ffdfc510b54d8acc1d0ea86b334ccc628b8ee524 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Mon, 24 Apr 2023 15:31:43 +0200 Subject: [PATCH] Do not assume Reference when Schema is requested --- src/SpecBaseObject.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SpecBaseObject.php b/src/SpecBaseObject.php index 1de429b..073171d 100644 --- a/src/SpecBaseObject.php +++ b/src/SpecBaseObject.php @@ -12,6 +12,7 @@ use cebe\openapi\json\JsonPointer; use cebe\openapi\json\JsonReference; use cebe\openapi\spec\Reference; +use cebe\openapi\spec\Schema; use cebe\openapi\spec\Type; /** @@ -153,7 +154,7 @@ protected function instantiate($type, $data) return $data; } - if (is_array($data) && isset($data['$ref'])) { + if (is_array($data) && isset($data['$ref']) && $type !== Schema::class) { return new Reference($data, $type); }