diff --git a/src/SpecBaseObject.php b/src/SpecBaseObject.php index ef93401e..19ed758f 100644 --- a/src/SpecBaseObject.php +++ b/src/SpecBaseObject.php @@ -13,6 +13,7 @@ use cebe\openapi\json\JsonReference; use cebe\openapi\spec\Reference; use cebe\openapi\spec\Type; +use \JsonSerializable; /** * Base class for all spec objects. @@ -20,7 +21,7 @@ * Implements property management and validation basics. * */ -abstract class SpecBaseObject implements SpecObjectInterface, DocumentContextInterface, RawSpecDataInterface +abstract class SpecBaseObject implements SpecObjectInterface, DocumentContextInterface, JsonSerializable, RawSpecDataInterface { private $_rawSpec; private $_properties = []; @@ -528,6 +529,10 @@ public function getExtensions(): array return $extensions; } + public function jsonSerialize() { + return $this->getSerializableData(); + } + public function getRawSpecData(): array { return $this->_rawSpec;