diff --git a/lib/TestBlock.php b/lib/TestBlock.php
index bacece4cc1f5e0de5bb1d41a588408279da87acd..031f5f199a4bc74d7a668db918c4a2540288a216 100644
--- a/lib/TestBlock.php
+++ b/lib/TestBlock.php
@@ -12,8 +12,29 @@
 use Courseware\BlockTypes\BlockType;
 use Opis\JsonSchema\Schema;
 
+// use old API with Stud.IP < 6.0
+if (class_exists('Opis\JsonSchema\Schema')) {
+    trait VipsJsonSchema
+    {
+        public static function getJsonSchema(): Schema
+        {
+            return Schema::fromJsonString(self::_getJsonSchema());
+        }
+    }
+} else {
+    trait VipsJsonSchema
+    {
+        public static function getJsonSchema(): string
+        {
+            return self::_getJsonSchema();
+        }
+    }
+}
+
 class TestBlock extends BlockType
 {
+    use VipsJsonSchema;
+
     /**
      * Get a short string describing this type of block.
      */
@@ -49,7 +70,7 @@ class TestBlock extends BlockType
     /**
      * Get the JSON schema for the payload of this block type.
      */
-    public static function getJsonSchema(): Schema
+    public static function _getJsonSchema(): string
     {
         $schema = [
             'type' => 'object',
@@ -60,7 +81,7 @@ class TestBlock extends BlockType
             ]
         ];
 
-        return Schema::fromJsonString(json_encode($schema));
+        return json_encode($schema);
     }
 
     /**