diff --git a/src/SpecBaseObject.php b/src/SpecBaseObject.php index 1de429b..570b6f1 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 +abstract class SpecBaseObject implements SpecObjectInterface, DocumentContextInterface, JsonSerializable { private $_properties = []; private $_errors = []; @@ -525,4 +526,8 @@ public function getExtensions(): array } return $extensions; } + + public function jsonSerialize() { + return $this->getSerializableData(); + } }