public function toObject()
    {
        $object = $this->toArray();

        //fix type to object
        if (isset($object['properties'])) {
            $object['properties'] = (object)$object['properties'];
        }

        foreach (['anyOf', 'allOf', 'oneOf', 'not'] as $property) {
            //fix type to object
            if (isset($object[$property])) {
                foreach ($object[$property] as &$propertyItem) {
                    $propertyItem = (object)$propertyItem;
                }
            }
        }

        return (object)$object;
    }